Documentation ¶
Overview ¶
Package vpn provides interface for vpn management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVPNAIsAlreadyStarted = errors.New("vpn is already started") ErrTunnelAlreadyExists = errors.New("tunnel already exists") )
Functions ¶
Types ¶
type Credentials ¶
Credentials define a possible set of credentials required to connect to the VPN server
func (Credentials) IsOpenVPNDefined ¶
func (c Credentials) IsOpenVPNDefined() bool
IsOpenVPNDefined returns true if both username and password are defined
type Events ¶
type Events struct { Connected events.PublishSubcriber[events.DataConnect] Disconnected events.PublishSubcriber[events.DataDisconnect] }
func NewInternalVPNEvents ¶
func NewInternalVPNEvents() *Events
func (*Events) Subscribe ¶
func (e *Events) Subscribe(to InternalVPNPublisher)
type InternalVPNPublisher ¶
type InternalVPNPublisher interface { NotifyConnect(events.DataConnect) error NotifyDisconnect(events.DataDisconnect) error }
type LibConfigGetter ¶
LibConfigGetter is interface to acquire config for vpn implementation library
type ServerData ¶
type ServerData struct { IP netip.Addr Hostname string // used in openvpn server certificate validation Name string // status display only Country string // status display only City string // status display only Protocol config.Protocol NordLynxPublicKey string Obfuscated bool OpenVPNVersion string VirtualLocation bool PostQuantum bool }
ServerData required to connect to VPN server.
type State ¶
type State string
State type represents valid openvpn states type
const ( // UnknownState is reported when state middleware cannot parse state from string (i.e. it's undefined in list above), // usually that means that newer openvpn version reports something extra UnknownState State = "UNKNOWN" // ConnectingState is reported by client and server mode and is indicator of openvpn startup ConnectingState State = "CONNECTING" // WaitState is reported by client in udp mode indicating that connect request is send and response is waiting WaitState State = "WAIT" // AuthenticatingState is reported by client indicating that client is trying to authenticate itself to server AuthenticatingState State = "AUTH" // GetConfigState indicates that client is waiting for config from server (push based options) GetConfigState State = "GET_CONFIG" // AssignIPState indicates that client is trying to setup tunnel with provided ip addresses AssignIPState State = "ASSIGN_IP" // AddRoutesState indicates that client is setuping routes on tunnel AddRoutesState State = "ADD_ROUTES" // ConnectedState is reported by both client and server and means that client is successfully connected and server is ready // to server incoming client connect requests ConnectedState State = "CONNECTED" // ReconnectingState indicates that client lost connection and is trying to reconnect itself ReconnectingState State = "RECONNECTING" // ExitingState is reported by both client and server and means that openvpn process is exiting by any reasons (normal shutdown // or fatal error reported before this state) ExitingState State = "EXITING" // ExitedState fake openvpn state which indicated that openvpn has been shutdown ExitedState State = "EXITED" )
func StringToState ¶
type VPN ¶
type VPN interface { Start(context.Context, Credentials, ServerData) error Stop() error State() State // required because of OpenVPN IsActive() bool Tun() tunnel.T // required because of OpenVPN NetworkChanged() error // GetConnectionParameters returns ServerData of current connection and true if connection is established, or empty // ServerData and false if it isn't. GetConnectionParameters() (ServerData, bool) }
VPN defines a set of operations that any type that wants to act as a vpn must implement.
Directories ¶
Path | Synopsis |
---|---|
Package nordlynx provides nordlynx vpn technology.
|
Package nordlynx provides nordlynx vpn technology. |
libtelio
Package libtelio wraps generated Go bindings so that the rest of the project would not need C dependencies to run unit tests.
|
Package libtelio wraps generated Go bindings so that the rest of the project would not need C dependencies to run unit tests. |
Package openvpn provides OpenVPN technology.
|
Package openvpn provides OpenVPN technology. |
Click to show internal directories.
Click to hide internal directories.