wiresocks

package
v1.0.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVtunUDPForwarder

func NewVtunUDPForwarder(localBind, dest string, vtun *VirtualTun, mtu int, ctx context.Context) error

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

func ResolveIPPAndPort(addr string) (string, error)

func RunScan

func RunScan(ctx *context.Context, rtt int) (result []string, err error)

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 PeerConfig struct {
	PublicKey    string
	PreSharedKey string
	Endpoint     *string
	KeepAlive    int
	AllowedIPs   []netip.Prefix
}

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()

Jump to

Keyboard shortcuts

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