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

Interface Bind

conn/conn.go:34–58  ·  view source on GitHub ↗

A Bind listens on a port for both IPv6 and IPv4 UDP traffic. A Bind interface may also be a PeekLookAtSocketFd or BindSocketToInterface, depending on the platform-specific implementation.

Source from the content-addressed store, hash-verified

32// A Bind interface may also be a PeekLookAtSocketFd or BindSocketToInterface,
33// depending on the platform-specific implementation.
34type Bind interface {
35 // Open puts the Bind into a listening state on a given port and reports the actual
36 // port that it bound to. Passing zero results in a random selection.
37 // fns is the set of functions that will be called to receive packets.
38 Open(port uint16) (fns []ReceiveFunc, actualPort uint16, err error)
39
40 // Close closes the Bind listener.
41 // All fns returned by Open must return net.ErrClosed after a call to Close.
42 Close() error
43
44 // SetMark sets the mark for each packet sent through this Bind.
45 // This mark is passed to the kernel as the socket option SO_MARK.
46 SetMark(mark uint32) error
47
48 // Send writes one or more packets in bufs to address ep. The length of
49 // bufs must not exceed BatchSize().
50 Send(bufs [][]byte, ep Endpoint) error
51
52 // ParseEndpoint creates a new endpoint from a string.
53 ParseEndpoint(s string) (Endpoint, error)
54
55 // BatchSize is the number of buffers expected to be passed to
56 // the ReceiveFuncs, and the maximum expected to be passed to SendBatch.
57 BatchSize() int
58}
59
60// BindSocketToInterface is implemented by Bind objects that support being
61// tied to a single network interface. Used by wireguard-windows.

Callers 30

mainFunction · 0.65
OpenMethod · 0.65
OpenMethod · 0.65
CreateTUNFunction · 0.65
BindUpdateMethod · 0.65
mainFunction · 0.65
mainFunction · 0.65
Test_listenConfigFunction · 0.65

Implementers 4

StdNetBindconn/bind_std.go
WinRingBindconn/bind_windows.go
ChannelBindconn/bindtest/bindtest.go
fakeBindSizeddevice/device_test.go

Calls

no outgoing calls

Tested by

no test coverage detected