Skip to content

Commit

Permalink
add dummy support for js,wasm (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjebs authored Feb 14, 2025
1 parent afc3991 commit bb94b26
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tcplisten/socket.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x)
//go:build !js && !wasm && (linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x))

package tcplisten

Expand Down
2 changes: 1 addition & 1 deletion tcplisten/socket_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux || dragonfly || freebsd || netbsd || openbsd || rumprun
//go:build !js && !wasm && (linux || dragonfly || freebsd || netbsd || openbsd || rumprun)

package tcplisten

Expand Down
17 changes: 17 additions & 0 deletions tcplisten/tcplisten_js_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package tcplisten

import (
"net"
)

// A dummy implementation for js,wasm
type Config struct {
ReusePort bool
DeferAccept bool
FastOpen bool
Backlog int
}

func (cfg *Config) NewListener(network, addr string) (net.Listener, error) {
return net.Listen(network, addr)
}

0 comments on commit bb94b26

Please sign in to comment.