clients

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	PublicKey  string   `json:"publicKey"`
	AllowedIPs []string `json:"allowedIps"`
	Endpoint   string   `json:"endpoint"`
}

type PeerBandwidth

type PeerBandwidth struct {
	PublicKey string  `json:"publicKey"`
	BytesIn   float64 `json:"bytesIn"`
	BytesOut  float64 `json:"bytesOut"`
}

type PeerReading

type PeerReading struct {
	BytesReceived    int64
	BytesTransmitted int64
	LastChecked      time.Time
}

type PortRange

type PortRange struct {
	Min      uint16 `json:"min"`
	Max      uint16 `json:"max"`
	Protocol string `json:"protocol"` // "tcp" or "udp"
}

type Target

type Target struct {
	SourcePrefix string      `json:"sourcePrefix"`
	DestPrefix   string      `json:"destPrefix"`
	RewriteTo    string      `json:"rewriteTo,omitempty"`
	DisableIcmp  bool        `json:"disableIcmp,omitempty"`
	PortRange    []PortRange `json:"portRange,omitempty"`
}

type WgConfig

type WgConfig struct {
	IpAddress string   `json:"ipAddress"`
	Peers     []Peer   `json:"peers"`
	Targets   []Target `json:"targets"`
}

type WireGuardService

type WireGuardService struct {
	Port uint16

	// Proxy manager for tunnel
	TunnelIP string
	// contains filtered or unexported fields
}

func NewWireGuardService

func NewWireGuardService(interfaceName string, port uint16, mtu int, host string, newtId string, wsClient *websocket.Client, dns string, useNativeInterface bool) (*WireGuardService, error)

func (*WireGuardService) Close

func (s *WireGuardService) Close()

func (*WireGuardService) GetNetstackNet

func (s *WireGuardService) GetNetstackNet() *netstack2.Net

GetNetstackNet returns the netstack network interface for use by other components

func (*WireGuardService) GetPublicKey

func (s *WireGuardService) GetPublicKey() wgtypes.Key

GetPublicKey returns the public key of this WireGuard service

func (*WireGuardService) IsReady

func (s *WireGuardService) IsReady() bool

IsReady returns true if the WireGuard service is ready to use

func (*WireGuardService) LoadRemoteConfig

func (s *WireGuardService) LoadRemoteConfig() error

func (*WireGuardService) ReportRTT

func (s *WireGuardService) ReportRTT(seconds float64)

ReportRTT allows reporting native RTTs to telemetry, rate-limited externally.

func (*WireGuardService) SetOnNetstackClose

func (s *WireGuardService) SetOnNetstackClose(callback func())

func (*WireGuardService) SetOnNetstackReady

func (s *WireGuardService) SetOnNetstackReady(callback func(*netstack2.Net))

SetOnNetstackReady sets a callback function to be called when the netstack interface is ready

func (*WireGuardService) SetOthertnet

func (s *WireGuardService) SetOthertnet(tnet *netstack.Net)

func (*WireGuardService) SetToken

func (s *WireGuardService) SetToken(token string)

func (*WireGuardService) StartDirectUDPRelay

func (s *WireGuardService) StartDirectUDPRelay(tunnelIP string) error

StartDirectUDPRelay starts a direct UDP relay from the main tunnel netstack to the clients' WireGuard. This bypasses the proxy by listening on the main tunnel's netstack and forwarding packets directly to the SharedBind that feeds the clients' WireGuard device. Responses are automatically routed back through the netstack by the SharedBind. tunnelIP is the IP address to listen on within the main tunnel's netstack.

func (*WireGuardService) StartHolepunch

func (s *WireGuardService) StartHolepunch(publicKey string, endpoint string, relayPort uint16)

StartHolepunch starts hole punching to a specific endpoint

func (*WireGuardService) StopDirectUDPRelay

func (s *WireGuardService) StopDirectUDPRelay()

StopDirectUDPRelay stops the direct UDP relay and closes the netstack listener

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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