openvpn

package
v0.0.0-...-846a3b6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOpenVPNVersion

func GetOpenVPNVersion(ovpnBinary string) []int

GetOpenVPNVersion trying to get openvpn binary version

Types

type ConnectionParams

type ConnectionParams struct {
	// contains filtered or unexported fields
}

ConnectionParams represents OpenVPN connection parameters

func CreateConnectionParams

func CreateConnectionParams(
	multihopExitSrvID string,
	tcp bool,
	hostPort int,
	hostIP net.IP,
	proxyType string,
	proxyAddress net.IP,
	proxyPort int,
	proxyUsername string,
	proxyPassword string) ConnectionParams

CreateConnectionParams creates OpenVPN connection parameters object

func (*ConnectionParams) SetCredentials

func (c *ConnectionParams) SetCredentials(username, password string)

SetCredentials update WG credentials

func (*ConnectionParams) WriteConfigFile

func (c *ConnectionParams) WriteConfigFile(
	localPort int,
	filePathToSave string,
	miAddr string,
	miPort int,
	logFile string,
	obfsproxyPort int,
	extraParameters string,
	isCanUseV24Params bool) error

WriteConfigFile saves OpenVPN connection parameters into a config file

type ManagementInterface

type ManagementInterface struct {
	// contains filtered or unexported fields
}

ManagementInterface structure

func StartManagementInterface

func StartManagementInterface(miSecret string, username string, password string, stateChan chan<- vpn.StateInfo) (mi *ManagementInterface, err error)

StartManagementInterface - starts TCP interface to communicate with IVPN application (server to listen incoming connections)

func (*ManagementInterface) GetRouteAddCommands

func (i *ManagementInterface) GetRouteAddCommands() []string

GetRouteAddCommands - return all detected route-add command

func (*ManagementInterface) ListenAddress

func (i *ManagementInterface) ListenAddress() (ip string, port int, e error)

ListenAddress returns ip:port of listener

func (*ManagementInterface) SendDisconnect

func (i *ManagementInterface) SendDisconnect() error

SendDisconnect - Send disconnect command to openvpn

func (*ManagementInterface) SetConnectionVerified

func (i *ManagementInterface) SetConnectionVerified()

SetConnectionVerified sets the current MI connection as verified: communication allowed

func (*ManagementInterface) StopManagementInterface

func (i *ManagementInterface) StopManagementInterface() error

StopManagementInterface - Stop management interface manually

type OpenVPN

type OpenVPN struct {
	// contains filtered or unexported fields
}

OpenVPN structure represents all data of OpenVPN connection

func NewOpenVpnObject

func NewOpenVpnObject(
	binaryPath string,
	configPath string,
	logFile string,
	isObfsProxy bool,
	extraParameters string,
	connectionParams ConnectionParams) (*OpenVPN, error)

NewOpenVpnObject creates new OpenVPN structure

func (*OpenVPN) Connect

func (o *OpenVPN) Connect(stateChan chan<- vpn.StateInfo) (retErr error)

Connect - SYNCHRONOUSLY execute openvpn process (wait until it finished)

func (*OpenVPN) DestinationIP

func (o *OpenVPN) DestinationIP() net.IP

DestinationIP - Get destination IPs (VPN host server or proxy server IP address) This information if required, for example, to allow this address in firewall

func (*OpenVPN) Disconnect

func (o *OpenVPN) Disconnect() error

Disconnect stops the connection

func (*OpenVPN) Init

func (o *OpenVPN) Init() error

Init performs basic initializations before connection It is useful, for example:

  • for WireGuard(Windows) - to ensure that WG service is fully uninstalled
  • for OpenVPN(Linux) - to ensure that OpenVPN has correct version

func (*OpenVPN) IsPaused

func (o *OpenVPN) IsPaused() bool

IsPaused checking if we are in paused state

func (*OpenVPN) OnRoutingChanged

func (o *OpenVPN) OnRoutingChanged() error

func (*OpenVPN) Pause

func (o *OpenVPN) Pause() error

Pause doing required operation for Pause (temporary restoring default DNS)

func (*OpenVPN) ResetManualDNS

func (o *OpenVPN) ResetManualDNS() error

ResetManualDNS restores DNS

func (*OpenVPN) Resume

func (o *OpenVPN) Resume() error

Resume doing required operation for Resume (restores DNS configuration before Pause)

func (*OpenVPN) SetManualDNS

func (o *OpenVPN) SetManualDNS(addr net.IP) error

SetManualDNS changes DNS to manual IP

func (*OpenVPN) Type

func (o *OpenVPN) Type() vpn.Type

Type just returns VPN type

Jump to

Keyboard shortcuts

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