vpn

package
v0.0.0-...-1e25372 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPortForwardingNotSupported = errors.New("custom port forwarding obtention is not supported")

Functions

This section is empty.

Types

type DNSLoop

type DNSLoop interface {
	ApplyStatus(ctx context.Context, status models.LoopStatus) (
		outcome string, err error)
	GetSettings() (settings settings.DNS)
}

type Firewall

type Firewall interface {
	SetVPNConnection(ctx context.Context, connection models.Connection, interfaceName string) error
	SetAllowedPort(ctx context.Context, port uint16, interfaceName string) error
	RemoveAllowedPort(ctx context.Context, port uint16) error
}

type Linker

type Linker interface {
	LinkList() (links []netlink.Link, err error)
	LinkByName(name string) (link netlink.Link, err error)
	LinkAdd(link netlink.Link) (linkIndex int, err error)
	LinkDel(link netlink.Link) (err error)
	LinkSetUp(link netlink.Link) (linkIndex int, err error)
	LinkSetDown(link netlink.Link) (err error)
}

type Loop

type Loop struct {
	// contains filtered or unexported fields
}

func NewLoop

func NewLoop(vpnSettings settings.VPN, ipv6Supported bool, vpnInputPorts []uint16,
	providers Providers, storage Storage, openvpnConf OpenVPN,
	netLinker NetLinker, fw Firewall, routing Routing,
	portForward PortForward, starter command.Starter,
	publicip PublicIPLoop, dnsLooper DNSLoop,
	logger log.LoggerInterface, client *http.Client,
	buildInfo models.BuildInformation, versionInfo bool) *Loop

func (*Loop) ApplyStatus

func (l *Loop) ApplyStatus(ctx context.Context, status models.LoopStatus) (
	outcome string, err error)

func (*Loop) GetSettings

func (l *Loop) GetSettings() (settings settings.VPN)

func (*Loop) GetStatus

func (l *Loop) GetStatus() (status models.LoopStatus)

func (*Loop) Run

func (l *Loop) Run(ctx context.Context, done chan<- struct{})

func (*Loop) SetSettings

func (l *Loop) SetSettings(ctx context.Context,
	vpn settings.VPN) (
	outcome string)

type NetLinker

type NetLinker interface {
	AddrReplace(link netlink.Link, addr netlink.Addr) error
	Router
	Ruler
	Linker
	IsWireguardSupported() (ok bool, err error)
}

type OpenVPN

type OpenVPN interface {
	WriteConfig(lines []string) error
	WriteAuthFile(user, password string) error
	WriteAskPassFile(passphrase string) error
}

type PortForward

type PortForward interface {
	UpdateWith(settings portforward.Settings) (err error)
}

type PortForwarder

type PortForwarder interface {
	Name() string
	PortForward(ctx context.Context, objects utils.PortForwardObjects) (
		port uint16, err error)
	KeepPortForward(ctx context.Context, objects utils.PortForwardObjects) (err error)
}

type Provider

type Provider interface {
	GetConnection(selection settings.ServerSelection, ipv6Supported bool) (connection models.Connection, err error)
	OpenVPNConfig(connection models.Connection, settings settings.OpenVPN, ipv6Supported bool) (lines []string)
	Name() string
	FetchServers(ctx context.Context, minServers int) (
		servers []models.Server, err error)
}

type Providers

type Providers interface {
	Get(providerName string) provider.Provider
}

type PublicIPLoop

type PublicIPLoop interface {
	StartSingleRun()
	ClearData() (err error)
}

type Router

type Router interface {
	RouteList(family int) (routes []netlink.Route, err error)
	RouteAdd(route netlink.Route) error
}

type Routing

type Routing interface {
	VPNLocalGatewayIP(vpnInterface string) (gateway netip.Addr, err error)
}

type Ruler

type Ruler interface {
	RuleAdd(rule netlink.Rule) error
	RuleDel(rule netlink.Rule) error
}

type Storage

type Storage interface {
	FilterServers(provider string, selection settings.ServerSelection) (servers []models.Server, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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