Documentation ¶
Index ¶
- func Connect()
- func CreateCredentials(username, password string)
- func Disconnect()
- func GenerateVPNConfig(hostname, protocol string)
- func GetServers(countryCode string) *[]IPVServer
- func IsVPNProcessRunning() (bool, int, error)
- func PingAllServers(servers *[]IPVServer) *[]IPVServer
- func SelectServerPrompt(servers *[]IPVServer, n int) string
- type ByLatency
- type ClientInfo
- type IPVServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCredentials ¶
func CreateCredentials(username, password string)
CreateCredentials creates a new credentials file. It replaces the previous file if it exists.
func GenerateVPNConfig ¶
func GenerateVPNConfig(hostname, protocol string)
GenerateVPNConfig generate OpenVPN config file for hostname
func GetServers ¶
GetServers returns pointer to a slice of ipvanish servers. Pointer is returned as slice holds many elements.
func IsVPNProcessRunning ¶
IsVPNProcessRunning checks if VPN process is running. It returns a boolean, an int (pid) and error (if any).
func PingAllServers ¶
PingAllServers records latencies (RTT) for all ipvanish servers. When the number of servers passed is large, ping might not complete for all servers. Hence, ping is run multiple times. Whenever, maxRTT is passed, OnIdle is called where the server IPs for which latencies have been recorded are removed. And ping runs again. factor is used to compute the number of ping cycles. It is assumed that in one cycle atleast 25 servers are being pinged successfully.
func SelectServerPrompt ¶
SelectServerPrompt asks user to choose a server to connect to and returns the hostname of the chosen server.
Types ¶
type ByLatency ¶
type ByLatency []IPVServer
ByLatency implements sort.Interface based on Latency field
type ClientInfo ¶
type ClientInfo struct { IPAddress string `json:"ip_address"` Location struct { CountryName string `json:"country_name"` Region string `json:"region"` City string `json:"city"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` } `json:"location"` VPN struct { Enabled bool `json:"enabled"` Secure bool `json:"secure"` } `json:"vpn"` }
ClientInfo represents current connection info of user
func GetClientInfo ¶
func GetClientInfo() ClientInfo
GetClientInfo returns current connection info of user