wiresocks

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVtunUDPForwarder

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

func RunScan

func RunScan(ctx context.Context, l *slog.Logger, opts ScanOptions) (result []ipscanner.IPInfo, err error)

Types

type Configuration

type Configuration struct {
	Interface *InterfaceConfig
	Peers     []PeerConfig
}

func ParseConfig

func ParseConfig(path string, endpoint string) (*Configuration, error)

ParseConfig takes the path of a configuration file and parses it into Configuration

type InterfaceConfig

type InterfaceConfig struct {
	PrivateKey string
	Addresses  []netip.Addr
	DNS        []netip.Addr
	MTU        int
}

func ParseInterface

func ParseInterface(cfg *ini.File) (InterfaceConfig, error)

ParseInterface parses the [Interface] section

type PeerConfig

type PeerConfig struct {
	PublicKey    string
	PreSharedKey string
	Endpoint     string
	KeepAlive    int
	AllowedIPs   []netip.Prefix
	Trick        bool
}

func ParsePeers

func ParsePeers(cfg *ini.File) ([]PeerConfig, error)

ParsePeers parses the [Peer] section and extract the information into `peers`

type ScanOptions

type ScanOptions struct {
	V4     bool
	V6     bool
	MaxRTT time.Duration
}

type VirtualTun

type VirtualTun struct {
	Tnet   *netstack.Net
	Logger *slog.Logger
	Dev    *device.Device
	Ctx    context.Context
}

VirtualTun stores a reference to netstack network and DNS configuration

func StartWireguard

func StartWireguard(ctx context.Context, l *slog.Logger, conf *Configuration) (*VirtualTun, error)

StartWireguard creates a tun interface on netstack given a configuration

func (*VirtualTun) StartProxy

func (vt *VirtualTun) StartProxy(bindAddress netip.AddrPort) (netip.AddrPort, error)

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