wg

package
v0.0.0-...-cabb48b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// github.com/WireGuard/wireguard-go/blob/12269c276/device/queueconstants_android.go#L13
	IdealBatchSize = conn.IdealBatchSize
)
View Source
const StdNetSupportsStickySockets = false

no netlink on Androids: github.com/WireGuard/wireguard-go/blob/12269c2761/device/sticky_linux.go#L28 for linux: StdNetSupportsStickySockets = true

Variables

This section is empty.

Functions

func ReadStats

func ReadStats(who string, id uintptr, cfn core.Work[string]) *ifstats

Types

type Amnezia

type Amnezia struct {
	Jc, Jmin, Jmax uint16 // unused: junk packet count, min, max

	S1, S2         uint16 // handshake init/resp pkt sizes
	H1, H2, H3, H4 uint32 // modified msg types [4]byte
	// contains filtered or unexported fields
}

Jc (Junk packet count) - number of packets with random data that are sent before the start of the session Jmin (Junk packet minimum size) - minimum packet size for Junk packet. That is, all randomly generated packets will have a size no smaller than Jmin. Jmax (Junk packet maximum size) - maximum size for Junk packets S1 (Init packet junk size) - the size of random data that will be added to the init packet, the size of which is initially fixed. S2 (Response packet junk size) - the size of random data that will be added to the response packet, the size of which is initially fixed. H1 (Init packet magic header) - the header of the first byte of the handshake H2 (Response packet magic header) - header of the first byte of the handshake response H4 (Transport packet magic header) - header of the packet of the data packet H3 (Underload packet magic header) - UnderLoad packet header."

func NewAmnezia

func NewAmnezia(id string) *Amnezia

func (*Amnezia) Same

func (a *Amnezia) Same(b *Amnezia) bool

func (*Amnezia) Set

func (a *Amnezia) Set() bool

func (*Amnezia) String

func (a *Amnezia) String() string

type ErrUDPGSODisabled

type ErrUDPGSODisabled struct {
	RetryErr error // err, if any, on retry; may be nil
	// contains filtered or unexported fields
}

func (ErrUDPGSODisabled) Error

func (e ErrUDPGSODisabled) Error() string

func (ErrUDPGSODisabled) Unwrap

func (e ErrUDPGSODisabled) Unwrap() error

type PktDir

type PktDir string
const (
	Rcv PktDir = "recv"
	Snd PktDir = "send"
	Con PktDir = "conn" // e.g. dial, announce, accept
	Opn PktDir = "open" // open conn to the wg endpoint
)

type StdNetBind

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

func NewEndpoint

func NewEndpoint(id string, d connector, pm *core.Volatile[*multihost.MHMap], f rwobserver, a *core.Volatile[*Amnezia]) *StdNetBind

TODO: get d, ep, f, rb through an Opts bag?

func (*StdNetBind) BatchSize

func (s *StdNetBind) BatchSize() int

func (*StdNetBind) Close

func (s *StdNetBind) Close() error

func (*StdNetBind) Open

func (s *StdNetBind) Open(uport uint16) ([]conn.ReceiveFunc, uint16, error)

func (*StdNetBind) ParseEndpoint

func (e *StdNetBind) ParseEndpoint(s string) (conn.Endpoint, error)

func (*StdNetBind) Pause

func (s *StdNetBind) Pause() bool

Pause implements wgconn

func (*StdNetBind) RemoteAddr

func (s *StdNetBind) RemoteAddr() netip.AddrPort

func (*StdNetBind) Resume

func (s *StdNetBind) Resume() bool

Resume implements wgconn

func (*StdNetBind) Send

func (s *StdNetBind) Send(buf [][]byte, peer conn.Endpoint) (err error)

func (*StdNetBind) SetMark

func (s *StdNetBind) SetMark(mark uint32) (err error)

from: github.com/WireGuard/wireguard-go/blob/1417a47c8/conn/mark_unix.go

type StdNetBind2

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

StdNetBind2 implements Bind for all platforms. 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://github.com/golang/go/issues/45886#issuecomment-1218301564.

func NewEndpoint2

func NewEndpoint2(id string, d connector, pm *core.Volatile[*multihost.MHMap], f rwobserver, a *core.Volatile[*Amnezia]) *StdNetBind2

func (*StdNetBind2) BatchSize

func (s *StdNetBind2) BatchSize() int

TODO: When all Binds handle IdealBatchSize, remove this dynamic function and rename the IdealBatchSize constant to BatchSize.

func (*StdNetBind2) Close

func (s *StdNetBind2) Close() error

func (*StdNetBind2) Open

func (s *StdNetBind2) Open(uport uint16) ([]conn.ReceiveFunc, uint16, error)

func (*StdNetBind2) ParseEndpoint

func (e *StdNetBind2) ParseEndpoint(s string) (conn.Endpoint, error)

func (*StdNetBind2) Pause

func (s *StdNetBind2) Pause() bool

func (*StdNetBind2) RemoteAddr

func (s *StdNetBind2) RemoteAddr() netip.AddrPort

func (*StdNetBind2) Resume

func (s *StdNetBind2) Resume() bool

func (*StdNetBind2) Send

func (s *StdNetBind2) Send(bufs [][]byte, peer conn.Endpoint) (err error)

func (*StdNetBind2) SetMark

func (s *StdNetBind2) SetMark(mark uint32) (err error)

from: github.com/WireGuard/wireguard-go/blob/1417a47c8/conn/mark_unix.go

type StdNetEndpoint

type StdNetEndpoint struct {
	netip.AddrPort
	// contains filtered or unexported fields
}

func (StdNetEndpoint) ClearSrc

func (StdNetEndpoint) ClearSrc()

func (StdNetEndpoint) DstIP

func (e StdNetEndpoint) DstIP() netip.Addr

func (StdNetEndpoint) DstToBytes

func (e StdNetEndpoint) DstToBytes() []byte

func (StdNetEndpoint) DstToString

func (e StdNetEndpoint) DstToString() string

func (StdNetEndpoint) SrcIP

func (e StdNetEndpoint) SrcIP() netip.Addr

func (StdNetEndpoint) SrcToString

func (e StdNetEndpoint) SrcToString() string

type StdNetEndpoint2

type StdNetEndpoint2 struct {
	// AddrPort is the endpoint destination.
	netip.AddrPort
	// contains filtered or unexported fields
}

func (*StdNetEndpoint2) ClearSrc

func (e *StdNetEndpoint2) ClearSrc()

func (*StdNetEndpoint2) DstIP

func (e *StdNetEndpoint2) DstIP() netip.Addr

func (*StdNetEndpoint2) DstToBytes

func (e *StdNetEndpoint2) DstToBytes() []byte

func (*StdNetEndpoint2) DstToString

func (e *StdNetEndpoint2) DstToString() string

func (*StdNetEndpoint2) SrcIP

func (e *StdNetEndpoint2) SrcIP() netip.Addr

func (*StdNetEndpoint2) SrcIfidx

func (e *StdNetEndpoint2) SrcIfidx() int32

func (*StdNetEndpoint2) SrcToString

func (e *StdNetEndpoint2) SrcToString() string

Jump to

Keyboard shortcuts

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