wireguard

package
v1.11.0-beta.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: GPL-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientBind

type ClientBind struct {
	// contains filtered or unexported fields
}

func NewClientBind

func NewClientBind(ctx context.Context, logger logger.Logger, dialer N.Dialer, isConnect bool, connectAddr netip.AddrPort, reserved [3]uint8) *ClientBind

func (*ClientBind) BatchSize added in v1.3.0

func (c *ClientBind) BatchSize() int

func (*ClientBind) Close

func (c *ClientBind) Close() error

func (*ClientBind) Open

func (c *ClientBind) Open(port uint16) (fns []conn.ReceiveFunc, actualPort uint16, err error)

func (*ClientBind) ParseEndpoint

func (c *ClientBind) ParseEndpoint(s string) (conn.Endpoint, error)

func (*ClientBind) Send

func (c *ClientBind) Send(bufs [][]byte, ep conn.Endpoint) error

func (*ClientBind) SetMark

func (c *ClientBind) SetMark(mark uint32) error

func (*ClientBind) SetReservedForEndpoint added in v1.3.0

func (c *ClientBind) SetReservedForEndpoint(destination netip.AddrPort, reserved [3]byte)

type Device

type Device interface {
	wgTun.Device
	N.Dialer
	Start() error
	SetDevice(device *device.Device)
}

func NewDevice

func NewDevice(options DeviceOptions) (Device, error)

type DeviceOptions

type DeviceOptions struct {
	Context        context.Context
	Logger         logger.ContextLogger
	System         bool
	Handler        tun.Handler
	UDPTimeout     time.Duration
	CreateDialer   func(interfaceName string) N.Dialer
	Name           string
	MTU            uint32
	Address        []netip.Prefix
	AllowedAddress []netip.Prefix
}

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(options EndpointOptions) (*Endpoint, error)

func (*Endpoint) BindUpdate

func (e *Endpoint) BindUpdate() error

func (*Endpoint) Close

func (e *Endpoint) Close() error

func (*Endpoint) DialContext

func (e *Endpoint) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)

func (*Endpoint) ListenPacket

func (e *Endpoint) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)

func (*Endpoint) Start

func (e *Endpoint) Start(resolve bool) error

type EndpointOptions

type EndpointOptions struct {
	Context      context.Context
	Logger       logger.ContextLogger
	System       bool
	Handler      tun.Handler
	UDPTimeout   time.Duration
	Dialer       N.Dialer
	CreateDialer func(interfaceName string) N.Dialer
	Name         string
	MTU          uint32
	Address      []netip.Prefix
	PrivateKey   string
	ListenPort   uint16
	ResolvePeer  func(domain string) (netip.Addr, error)
	Peers        []PeerOptions
	Workers      int
}

type PeerOptions

type PeerOptions struct {
	Endpoint                    M.Socksaddr
	PublicKey                   string
	PreSharedKey                string
	AllowedIPs                  []netip.Prefix
	PersistentKeepaliveInterval uint16
	Reserved                    []uint8
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL