Skip to content

Commit bb94b26

Browse files
authored
add dummy support for js,wasm (#1955)
1 parent afc3991 commit bb94b26

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

tcplisten/socket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x)
1+
//go:build !js && !wasm && (linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun || (zos && s390x))
22

33
package tcplisten
44

tcplisten/socket_other.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build linux || dragonfly || freebsd || netbsd || openbsd || rumprun
1+
//go:build !js && !wasm && (linux || dragonfly || freebsd || netbsd || openbsd || rumprun)
22

33
package tcplisten
44

tcplisten/tcplisten_js_wasm.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package tcplisten
2+
3+
import (
4+
"net"
5+
)
6+
7+
// A dummy implementation for js,wasm
8+
type Config struct {
9+
ReusePort bool
10+
DeferAccept bool
11+
FastOpen bool
12+
Backlog int
13+
}
14+
15+
func (cfg *Config) NewListener(network, addr string) (net.Listener, error) {
16+
return net.Listen(network, addr)
17+
}

0 commit comments

Comments
 (0)