diff --git a/tcplisten/socket.go b/tcplisten/socket.go index 4090f12986..e008f58292 100644 --- a/tcplisten/socket.go +++ b/tcplisten/socket.go @@ -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 diff --git a/tcplisten/socket_other.go b/tcplisten/socket_other.go index b3289c3225..65b98b01ce 100644 --- a/tcplisten/socket_other.go +++ b/tcplisten/socket_other.go @@ -1,4 +1,4 @@ -//go:build linux || dragonfly || freebsd || netbsd || openbsd || rumprun +//go:build !js && !wasm && (linux || dragonfly || freebsd || netbsd || openbsd || rumprun) package tcplisten diff --git a/tcplisten/tcplisten_js_wasm.go b/tcplisten/tcplisten_js_wasm.go new file mode 100644 index 0000000000..3c46c8e5af --- /dev/null +++ b/tcplisten/tcplisten_js_wasm.go @@ -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) +}