Documentation ¶
Index ¶
- func New(o *Opt) (netapi.Accepter, error)
- func NewDevice(device wun.Device, offset int) *wgDevice
- func Open(sc netlink.TunScheme, driver listener.TunEndpointDriver, mtu int) (_ stack.LinkEndpoint, err error)
- func OpenWriter(sc netlink.TunScheme, mtu int) (netlink.Tun, error)
- type ChannelTun
- func (p *ChannelTun) BatchSize() int
- func (p *ChannelTun) Close() error
- func (p *ChannelTun) Events() <-chan wun.Event
- func (p *ChannelTun) File() *os.File
- func (p *ChannelTun) Inbound(b []byte) (int, error)
- func (p *ChannelTun) MTU() (int, error)
- func (p *ChannelTun) Name() (string, error)
- func (p *ChannelTun) Outbound(b []byte) error
- func (p *ChannelTun) Read(b [][]byte, size []int, offset int) (int, error)
- func (p *ChannelTun) Write(b [][]byte, offset int) (int, error)
- type Endpoint
- func (*Endpoint) ARPHardwareType() header.ARPHardwareType
- func (*Endpoint) AddHeader(*stack.PacketBuffer)
- func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)
- func (e *Endpoint) Capabilities() stack.LinkEndpointCapabilities
- func (e *Endpoint) Close() error
- func (e *Endpoint) IsAttached() bool
- func (e *Endpoint) LinkAddress() tcpip.LinkAddress
- func (e *Endpoint) MTU() uint32
- func (*Endpoint) MaxHeaderLength() uint16
- func (*Endpoint) ParseHeader(*stack.PacketBuffer) bool
- func (e *Endpoint) Wait()
- func (e *Endpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)
- func (e *Endpoint) Writer() netlink.Tun
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶ added in v0.3.4
func Open(sc netlink.TunScheme, driver listener.TunEndpointDriver, mtu int) (_ stack.LinkEndpoint, err error)
Types ¶
type ChannelTun ¶ added in v0.3.5
type ChannelTun struct {
// contains filtered or unexported fields
}
func NewChannelTun ¶ added in v0.3.5
func NewChannelTun(ctx context.Context, mtu int) *ChannelTun
func (*ChannelTun) BatchSize ¶ added in v0.3.5
func (p *ChannelTun) BatchSize() int
func (*ChannelTun) Close ¶ added in v0.3.5
func (p *ChannelTun) Close() error
func (*ChannelTun) Events ¶ added in v0.3.5
func (p *ChannelTun) Events() <-chan wun.Event
func (*ChannelTun) File ¶ added in v0.3.5
func (p *ChannelTun) File() *os.File
func (*ChannelTun) MTU ¶ added in v0.3.5
func (p *ChannelTun) MTU() (int, error)
func (*ChannelTun) Name ¶ added in v0.3.5
func (p *ChannelTun) Name() (string, error)
func (*ChannelTun) Outbound ¶ added in v0.3.5
func (p *ChannelTun) Outbound(b []byte) error
type Endpoint ¶
type Endpoint struct {
// 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 ¶
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.PacketBuffer)
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 ¶
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) 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) ParseHeader ¶
func (*Endpoint) ParseHeader(*stack.PacketBuffer) bool
ParseHeader implements stack.LinkEndpoint.ParseHeader.
func (*Endpoint) WritePackets ¶
WritePackets stores outbound packets into the channel. Multiple concurrent calls are permitted.