MCPcopy Create free account
hub / github.com/encodeous/nylon / StdNetBind

Struct StdNetBind

polyamide/conn/bind_std.go:33–50  ·  view source on GitHub ↗

StdNetBind implements Bind for all platforms. While Windows has its own Bind (see bind_windows.go), it may fall back to StdNetBind. TODO: Remove usage of ipv{4,6}.PacketConn when net.UDPConn has comparable methods for sending and receiving multiple datagrams per-syscall. See the proposal in https://

Source from the content-addressed store, hash-verified

31// methods for sending and receiving multiple datagrams per-syscall. See the
32// proposal in https://github.com/golang/go/issues/45886#issuecomment-1218301564.
33type StdNetBind struct {
34 mu sync.Mutex // protects all fields except as specified
35 ipv4 *net.UDPConn
36 ipv6 *net.UDPConn
37 ipv4PC *ipv4.PacketConn // will be nil on non-Linux
38 ipv6PC *ipv6.PacketConn // will be nil on non-Linux
39 ipv4TxOffload bool
40 ipv4RxOffload bool
41 ipv6TxOffload bool
42 ipv6RxOffload bool
43
44 // these two fields are not guarded by mu
45 udpAddrPool sync.Pool
46 msgsPool sync.Pool
47
48 blackhole4 bool
49 blackhole6 bool
50}
51
52func NewStdNetBind() Bind {
53 return &StdNetBind{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected