Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process interface { // Type just returns VPN type Type() Type // Init performs basic initializations before connection // It is usefull, for example, for WireGuard(Windows) - to ensure that WG service is fully uninstalled // (currently, in use by WireGuard(Windows)) Init() error // Connect - SYNCHRONOUSLY execute openvpn process (wait until it finished) Connect(stateChan chan<- StateInfo) error Disconnect() error Pause() error Resume() error IsPaused() bool SetManualDNS(addr net.IP) error ResetManualDNS() error // DestinationIP - Get destination IP (VPN host server or proxy server IP address) // This information if required, for example, to allow this address in firewall DestinationIP() net.IP OnRoutingChanged() error }
Process represents VPN object operations
type ReconnectionRequiredError ¶
type ReconnectionRequiredError struct {
Err error
}
ReconnectionRequiredError object can be returned by vpn.Process.Connect() function which means that it requesting to do re-connect immediately
func (*ReconnectionRequiredError) Error ¶
func (e *ReconnectionRequiredError) Error() string
func (*ReconnectionRequiredError) Unwrap ¶
func (e *ReconnectionRequiredError) Unwrap() error
Unwrap returns inner error
type State ¶
type State int
State - state of VPN
const ( DISCONNECTED State = iota CONNECTING State = iota // OpenVPN's initial state. WAIT State = iota // (Client only) Waiting for initial response from server. AUTH State = iota // (Client only) Authenticating with server. GETCONFIG State = iota // (Client only) Downloading configuration options from server. ASSIGNIP State = iota // Assigning IP address to virtual network interface. ADDROUTES State = iota // Adding routes to system. CONNECTED State = iota // Initialization Sequence Completed. RECONNECTING State = iota // A restart has occurred. TCP_CONNECT State = iota // TCP_CONNECT EXITING State = iota // A graceful exit is in progress. )
Possible VPN state values (must be applicable for all protocols) Such stetes MUST be in use by ALL supportded VPN protocols:
DISCONNECTED CONNECTING CONNECTED EXITING
func ParseState ¶
ParseState - Converts string representation of OpenVPN state to vpn.State
type StateInfo ¶
type StateInfo struct { State State Description string VpnType Type Time int64 // unix time (seconds) IsTCP bool // applicable only for 'CONNECTED' state ClientIP net.IP // applicable only for 'CONNECTED' state ClientPort int // applicable only for 'CONNECTED' state (source port) ServerIP net.IP // applicable only for 'CONNECTED' state ServerPort int // applicable only for 'CONNECTED' state (destination port) ExitServerID string // applicable only for 'CONNECTED' state IsCanPause bool // applicable only for 'CONNECTED' state IsAuthError bool // applicable only for 'EXITING' state // TODO: try to avoid using this protocol-specific parameter in future // Currently, in use by OpenVPN connection to inform about "RECONNECTING" reason (e.g. "tls-error", "init_instance"...) // UI client using this info in order to determine is it necessary to try to connect with another port StateAdditionalInfo string }
StateInfo - VPN state + additional information
func NewStateInfo ¶
NewStateInfo - create new state object (not applicable for CONNECTED state)
Click to show internal directories.
Click to hide internal directories.