vpn

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: GPL-3.0 Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() (string, error)

CacheDir returns the directory used for vpngate cache files.

func ClearCache

func ClearCache() error

ClearCache removes cached vpngate data.

func Connect

func Connect(configPath string) error

Connect to a specified OpenVPN configuration. Blocks until openvpn exits, streaming its output through pkg/exec's logger.

func ConnectDetached

func ConnectDetached(configPath, managementAddr string, logWriter io.Writer, sysProcAttr *syscall.SysProcAttr) (*osexec.Cmd, error)

ConnectDetached starts openvpn with a management interface enabled at managementAddr, detached via sysProcAttr so it outlives the calling process, writing its combined stdout/stderr to logWriter. It returns as soon as the process has started; callers wait on the returned *exec.Cmd independently (via cmd.Wait()) to learn when it exits.

func GetList

func GetList(httpProxy string, socks5Proxy string) (*[]Server, error)

GetList returns a list of vpn servers.

func GetListWithOptions

func GetListWithOptions(httpProxy string, socks5Proxy string, opts ListOptions) (*[]Server, error)

GetListWithOptions returns a list of vpn servers with cache controls.

func SanitizeConfig

func SanitizeConfig(config []byte) ([]byte, []string)

SanitizeConfig comments out any script/plugin directives in an OpenVPN config, returning the sanitized config and the names of the stripped directives (for logging). Comment lines and blank lines pass through untouched; matching is on the first whitespace-separated token, case-insensitively, so e.g. `up` is stripped but `update-resolv-conf` would not be. The original newline structure is preserved byte for byte otherwise.

Types

type ListOptions

type ListOptions struct {
	Refresh bool
	NoCache bool
}

ListOptions controls how the vpn server list is fetched.

type Server

type Server struct {
	HostName          string `csv:"#HostName"`
	CountryLong       string `csv:"CountryLong"`
	CountryShort      string `csv:"CountryShort"`
	Score             int    `csv:"Score"`
	IPAddr            string `csv:"IP"`
	OpenVpnConfigData string `csv:"OpenVPN_ConfigData_Base64"`
	Ping              string `csv:"Ping"`
}

Server holds information about a vpn relay server

Jump to

Keyboard shortcuts

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