internal

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiDomain

func ApiDomain() string

func AuthKey

func AuthKey() string

func BackgroundLogger

func BackgroundLogger(d time.Duration)

func DialWg

func DialWg(ctx context.Context, network, address string) (net.Conn, error)

func ExtractEncodedLabel

func ExtractEncodedLabel(host, apiDomain string) (label string, ok bool)

func GetEncodedIPPort

func GetEncodedIPPort(addr netip.AddrPort) string

func GetIPForKey

func GetIPForKey(pub wgtypes.Key) netip.Addr

func GetListenPort

func GetListenPort() int

func GetLocalWgIp

func GetLocalWgIp() netip.Addr

func GetPublicKey

func GetPublicKey() wgtypes.Key

func GetTLSConfig

func GetTLSConfig() *tls.Config

func GetWgDeviceInfo

func GetWgDeviceInfo() (*wgtypes.Device, error)

func Initialize

func Initialize() error

func Keystorage

func Keystorage() string

func ListenTCPWg

func ListenTCPWg(addr *net.TCPAddr) (net.Listener, error)

func LookupEncodedIPPort

func LookupEncodedIPPort(sni string) *netip.AddrPort

func Must

func Must[T any](v T, err error) T

func PurgeStalePeers

func PurgeStalePeers(interval, maxIdle time.Duration)

func RelayServer

func RelayServer(tcpConn net.Conn, udpConn *net.UDPConn, addr net.Addr) error

RelayServer copies wireguard datagrams between a tcp conn and a udp socket. The tcp side frames each datagram with a 2 byte length prefix, tcp segmentation mangles them otherwise.

func RemovePeer

func RemovePeer(pub wgtypes.Key) error

func ResolveEndpoint added in v0.1.4

func ResolveEndpoint(ctx context.Context, endpoint string, attempt uint32) (string, error)

ResolveEndpoint turns host:port into the ip:port form wireguard-go accepts. A hostname can resolve to several addresses, v6 sorts first and attempt picks the next one when the current address stops passing traffic.

func SSLCertificateEmail

func SSLCertificateEmail() string

func ServerHost added in v0.1.4

func ServerHost() string

func TestOnlyRunLocalhost

func TestOnlyRunLocalhost() bool

func UseRelay

func UseRelay() bool

func WgSetIpc

func WgSetIpc(ins []string) error

Types

type AddPeerReq

type AddPeerReq struct {
	Key []byte
}

type AddPeerResp

type AddPeerResp struct {
	Key      []byte
	Endpoint string
}

Jump to

Keyboard shortcuts

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