Documentation ¶
Index ¶
- func ParseInterface(cfg *ini.File, device *DeviceConfig) error
- func ParsePeer(cfg *ini.File, device *DeviceConfig) error
- func TCPAddrFromAddrPort(addr netip.AddrPort) *net.TCPAddr
- type Configuration
- type CredentialValidator
- type DeviceConfig
- type DeviceSetting
- type RoutineSpawner
- type Socks5Config
- type TCPClientTunnelConfig
- type TCPServerTunnelConfig
- type VirtualTun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseInterface ¶
func ParseInterface(cfg *ini.File, device *DeviceConfig) error
ParseInterface parses the [Interface] section and extract the information into `device`
Types ¶
type Configuration ¶
type Configuration struct { Device *DeviceConfig Routines []RoutineSpawner }
func ParseConfig ¶
func ParseConfig(path string) (*Configuration, error)
ParseConfig takes the path of a configuration file and parses it into Configuration
type CredentialValidator ¶
type CredentialValidator struct {
// contains filtered or unexported fields
}
CredentialValidator stores the authentication data of a socks5 proxy
func (CredentialValidator) Valid ¶
func (c CredentialValidator) Valid(username, password string) bool
Valid checks the authentication data in CredentialValidator and compare them to username and password in constant time.
type DeviceConfig ¶
type DeviceConfig struct { SelfSecretKey string SelfEndpoint []netip.Addr PeerPublicKey string PeerEndpoint string DNS []netip.Addr KeepAlive int MTU int }
DeviceConfig contains the information to initiate a wireguard connection
type DeviceSetting ¶
type DeviceSetting struct {
// contains filtered or unexported fields
}
DeviceSetting contains the parameters for setting up a tun interface
type RoutineSpawner ¶
type RoutineSpawner interface {
SpawnRoutine(vt *VirtualTun)
}
RoutineSpawner spawns a routine (e.g. socks5, tcp static routes) after the configuration is parsed
type Socks5Config ¶
func (*Socks5Config) SpawnRoutine ¶
func (config *Socks5Config) SpawnRoutine(vt *VirtualTun)
SpawnRoutine spawns a socks5 server.
type TCPClientTunnelConfig ¶
func (*TCPClientTunnelConfig) SpawnRoutine ¶
func (conf *TCPClientTunnelConfig) SpawnRoutine(vt *VirtualTun)
SpawnRoutine spawns a local TCP server which acts as a proxy to the specified target
type TCPServerTunnelConfig ¶
func (*TCPServerTunnelConfig) SpawnRoutine ¶
func (conf *TCPServerTunnelConfig) SpawnRoutine(vt *VirtualTun)
SpawnRoutine spawns a TCP server on wireguard which acts as a proxy to the specified target
type VirtualTun ¶
type VirtualTun struct {
// contains filtered or unexported fields
}
VirtualTun stores a reference to netstack network and DNS configuration
func StartWireguard ¶
func StartWireguard(conf *DeviceConfig) (*VirtualTun, error)
StartWireguard creates a tun interface on netstack given a configuration
func (VirtualTun) LookupAddr ¶
LookupAddr lookups a hostname. DNS traffic may or may not be routed depending on VirtualTun's setting
func (VirtualTun) Resolve ¶
Resolve resolves a hostname and returns an IP. DNS traffic may or may not be routed depending on VirtualTun's setting
func (VirtualTun) ResolveAddrWithContext ¶
ResolveAddrWithContext resolves a hostname and returns an AddrPort. DNS traffic may or may not be routed depending on VirtualTun's setting