bind

package
v0.58.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityRecorder added in v0.50.0

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

func NewActivityRecorder added in v0.50.0

func NewActivityRecorder() *ActivityRecorder

func (*ActivityRecorder) GetLastActivities added in v0.50.0

func (r *ActivityRecorder) GetLastActivities() map[string]monotime.Time

GetLastActivities returns a snapshot of peer last activity

func (*ActivityRecorder) Remove added in v0.50.0

func (r *ActivityRecorder) Remove(publicKey string)

func (*ActivityRecorder) UpsertAddress added in v0.50.0

func (r *ActivityRecorder) UpsertAddress(publicKey string, address netip.AddrPort)

UpsertAddress adds or updates the address for a publicKey

type Endpoint added in v0.30.3

type Endpoint = wgConn.StdNetEndpoint

type ICEBind

type ICEBind struct {
	*wgConn.StdNetBind
	RecvChan chan RecvMessage
	// contains filtered or unexported fields
}

ICEBind is a bind implementation with two main features: 1. filter out STUN messages and handle them 2. forward the received packets to the WireGuard interface from the relayed connection

ICEBind.endpoints var is a map that stores the connection for each relayed peer. Fake address is just an IP address without port, in the format of 127.1.x.x where x.x is the last two octets of the peer address. We try to avoid to use the port because in the Send function the wgConn.Endpoint the port info is not exported.

func NewICEBind

func NewICEBind(transportNet transport.Net, filterFn udpmux.FilterFn, address wgaddr.Address, mtu uint16) *ICEBind

func (*ICEBind) ActivityRecorder added in v0.50.0

func (s *ICEBind) ActivityRecorder() *ActivityRecorder

func (*ICEBind) Close added in v0.30.3

func (s *ICEBind) Close() error

func (*ICEBind) GetICEMux

func (s *ICEBind) GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)

GetICEMux returns the ICE UDPMux that was created and used by ICEBind

func (*ICEBind) MTU added in v0.56.0

func (s *ICEBind) MTU() uint16

func (*ICEBind) Open added in v0.30.3

func (s *ICEBind) Open(uport uint16) ([]wgConn.ReceiveFunc, uint16, error)

func (*ICEBind) RemoveEndpoint added in v0.30.3

func (b *ICEBind) RemoveEndpoint(fakeIP netip.Addr)

func (*ICEBind) Send added in v0.30.3

func (b *ICEBind) Send(bufs [][]byte, ep wgConn.Endpoint) error

func (*ICEBind) SetEndpoint added in v0.30.3

func (b *ICEBind) SetEndpoint(fakeIP netip.Addr, conn net.Conn)

type PeerRecord added in v0.50.0

type PeerRecord struct {
	Address      netip.AddrPort
	LastActivity atomic.Int64 // UnixNano timestamp
}

type RecvMessage added in v0.30.3

type RecvMessage struct {
	Endpoint *Endpoint
	Buffer   []byte
}

Jump to

Keyboard shortcuts

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