Documentation ¶
Index ¶
- func NewVtunUDPForwarder(localBind, dest string, vtun *VirtualTun, mtu int, ctx context.Context) error
- func ParseInterface(cfg *ini.File, device *DeviceConfig) error
- func ParsePeers(cfg *ini.File, peers *[]PeerConfig, endpoint string) error
- func ResolveIPPAndPort(addr string) (string, error)
- func RunScan(ctx *context.Context, rtt int) (result []string, err error)
- type Configuration
- type DefaultLogger
- type DeviceConfig
- type DeviceSetting
- type PeerConfig
- type Socks5UDPForwarder
- type VirtualTun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewVtunUDPForwarder ¶
func ParseInterface ¶
func ParseInterface(cfg *ini.File, device *DeviceConfig) error
ParseInterface parses the [Interface] section and extract the information into `device`
func ParsePeers ¶
func ParsePeers(cfg *ini.File, peers *[]PeerConfig, endpoint string) error
ParsePeers parses the [Peer] section and extract the information into `peers`
func ResolveIPPAndPort ¶
Types ¶
type Configuration ¶
type Configuration struct {
Device *DeviceConfig
}
func ParseConfig ¶
func ParseConfig(path string, endpoint string) (*Configuration, error)
ParseConfig takes the path of a configuration file and parses it into Configuration
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
func (DefaultLogger) Debug ¶
func (l DefaultLogger) Debug(v ...interface{})
func (DefaultLogger) Error ¶
func (l DefaultLogger) Error(v ...interface{})
type DeviceConfig ¶
type DeviceConfig struct { SecretKey string Endpoint []netip.Addr Peers []PeerConfig DNS []netip.Addr MTU int ListenPort *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 PeerConfig ¶
type Socks5UDPForwarder ¶
type Socks5UDPForwarder struct {
// contains filtered or unexported fields
}
func NewSocks5UDPForwarder ¶
func NewSocks5UDPForwarder(localBind, socks5Server, dest string) (*Socks5UDPForwarder, error)
func (*Socks5UDPForwarder) Start ¶
func (f *Socks5UDPForwarder) Start()
type VirtualTun ¶
type VirtualTun struct { Tnet *netstack.Net SystemDNS bool Verbose bool Logger DefaultLogger Dev *device.Device Ctx context.Context }
VirtualTun stores a reference to netstack network and DNS configuration
func StartWireguard ¶
func StartWireguard(conf *DeviceConfig, verbose bool, ctx context.Context) (*VirtualTun, error)
StartWireguard creates a tun interface on netstack given a configuration
func (*VirtualTun) StartProxy ¶
func (vt *VirtualTun) StartProxy(bindAddress string)
StartProxy spawns a socks5 server.
func (*VirtualTun) Stop ¶
func (vt *VirtualTun) Stop()
Click to show internal directories.
Click to hide internal directories.