Documentation
¶
Index ¶
- func CacheDir() (string, error)
- func ClearCache() error
- func Connect(configPath string) error
- func ConnectDetached(configPath, managementAddr string, logWriter io.Writer, ...) (*osexec.Cmd, error)
- func GetList(httpProxy string, socks5Proxy string) (*[]Server, error)
- func GetListWithOptions(httpProxy string, socks5Proxy string, opts ListOptions) (*[]Server, error)
- func SanitizeConfig(config []byte) ([]byte, []string)
- type ListOptions
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
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 GetListWithOptions ¶
func GetListWithOptions(httpProxy string, socks5Proxy string, opts ListOptions) (*[]Server, error)
GetListWithOptions returns a list of vpn servers with cache controls.
func SanitizeConfig ¶
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 ¶
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