MCPcopy
hub / github.com/WireGuard/wireguard-go / StdNetBind

Struct StdNetBind

conn/bind_std.go:32–49  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected