Documentation ¶
Index ¶
- Constants
- Variables
- func NewTun(o *listener.Opts[*listener.Protocol_Tun]) (server.Server, error)
- type Endpoint
- func (*Endpoint) ARPHardwareType() header.ARPHardwareType
- func (*Endpoint) AddHeader(stack.PacketBufferPtr)
- func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)
- func (e *Endpoint) Capabilities() stack.LinkEndpointCapabilities
- func (e *Endpoint) Close()
- func (e *Endpoint) InjectInbound(protocol tcpip.NetworkProtocolNumber, pkt stack.PacketBufferPtr)
- func (e *Endpoint) InjectOutbound(dest tcpip.Address, packet *bufferv2.View) tcpip.Error
- func (e *Endpoint) IsAttached() bool
- func (e *Endpoint) LinkAddress() tcpip.LinkAddress
- func (e *Endpoint) MTU() uint32
- func (*Endpoint) MaxHeaderLength() uint16
- func (e *Endpoint) SetInbound(i inbound)
- func (e *Endpoint) Wait()
- func (e *Endpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)
- type PACKAGE_MARK_KEY
Constants ¶
const ( // MaxMsgsPerRecv is the maximum number of packets we want to retrieve // in a single RecvMMsg call. MaxMsgsPerRecv = 8 )
Variables ¶
var BufConfig = []int{128, 256, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}
BufConfig defines the shape of the buffer used to read packets from the NIC.
Functions ¶
Types ¶
type Endpoint ¶
type Endpoint struct { LinkEPCapabilities stack.LinkEndpointCapabilities // contains filtered or unexported fields }
Endpoint is link layer endpoint that stores outbound packets in a channel and allows injection of inbound packets.
func NewEndpoint ¶
func NewEndpoint(w writer, mtu uint32, linkAddr tcpip.LinkAddress) *Endpoint
New creates a new channel endpoint.
func (*Endpoint) ARPHardwareType ¶
func (*Endpoint) ARPHardwareType() header.ARPHardwareType
ARPHardwareType implements stack.LinkEndpoint.ARPHardwareType.
func (*Endpoint) AddHeader ¶
func (*Endpoint) AddHeader(stack.PacketBufferPtr)
AddHeader implements stack.LinkEndpoint.AddHeader.
func (*Endpoint) Attach ¶
func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)
Attach saves the stack network-layer dispatcher for use later when packets are injected.
func (*Endpoint) Capabilities ¶
func (e *Endpoint) Capabilities() stack.LinkEndpointCapabilities
Capabilities implements stack.LinkEndpoint.Capabilities.
func (*Endpoint) Close ¶
func (e *Endpoint) Close()
Close closes e. Further packet injections will return an error, and all pending packets are discarded. Close may be called concurrently with WritePackets.
func (*Endpoint) InjectInbound ¶
func (e *Endpoint) InjectInbound(protocol tcpip.NetworkProtocolNumber, pkt stack.PacketBufferPtr)
InjectInbound injects an inbound packet.
func (*Endpoint) InjectOutbound ¶
InjectOutbound writes a fully formed outbound packet directly to the link.
dest is used by endpoints with multiple raw destinations.
func (*Endpoint) IsAttached ¶
IsAttached implements stack.LinkEndpoint.IsAttached.
func (*Endpoint) LinkAddress ¶
func (e *Endpoint) LinkAddress() tcpip.LinkAddress
LinkAddress returns the link address of this endpoint.
func (*Endpoint) MTU ¶
MTU implements stack.LinkEndpoint.MTU. It returns the value initialized during construction.
func (*Endpoint) MaxHeaderLength ¶
MaxHeaderLength returns the maximum size of the link layer header. Given it doesn't have a header, it just returns 0.
func (*Endpoint) SetInbound ¶
func (e *Endpoint) SetInbound(i inbound)
func (*Endpoint) WritePackets ¶
WritePackets stores outbound packets into the channel. Multiple concurrent calls are permitted.
type PACKAGE_MARK_KEY ¶
type PACKAGE_MARK_KEY struct{}
func (PACKAGE_MARK_KEY) String ¶
func (PACKAGE_MARK_KEY) String() string