types

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: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypeName

func GetTypeName(cmd interface{}) string

GetTypeName returns objects type name (without package)

func Send

func Send(conn net.Conn, cmd interface{}, idx int) (retErr error)

Send sends a command to a connection : init+serialize+send

Types

type APIRequest

type APIRequest struct {
	CommandBase
	APIPath string
}

APIRequest do custom request to API

type APIResponse

type APIResponse struct {
	CommandBase
	APIPath      string
	ResponseData string
	Error        string
}

APIResponse contains the raw data of response to custom API request

type AccountStatus

type AccountStatus struct {
	CommandBase
}

AccountStatus get account status

type AccountStatusResp

type AccountStatusResp struct {
	CommandBase
	APIStatus       int
	APIErrorMessage string
	SessionToken    string
	Account         preferences.AccountStatus
}

AccountStatusResp - information about account status (or error info)

type CommandBase

type CommandBase struct {
	// this field represents command type
	Command string
	// Uses for separate request\response sessions.
	// Response messages must have same Index as request
	Idx int
}

CommandBase is a base object for communication with daemon. Contains fields required for all requests\responses.

func GetCommandBase

func GetCommandBase(messageData []byte) (CommandBase, error)

GetCommandBase deserializing to CommandBase object

type ConfigParamsResp

type ConfigParamsResp struct {
	CommandBase

	UserDefinedOvpnFile string
}

ConfigParamsResp return s configuration parameters

type Connect

type Connect struct {
	CommandBase
	VpnType    vpn.Type
	CurrentDNS string
	// Enable firewall before connection
	// (if true - the parameter 'firewallDuringConnection' will be ignored)
	FirewallOn bool
	// Enable firewall before connection and disable after disconnection
	// (has effect only if Firewall not enabled before)
	FirewallOnDuringConnection bool

	WireGuardParameters struct {
		Port struct {
			Port int
		}

		EntryVpnServer struct {
			Hosts []WGHost
		}
	}

	OpenVpnParameters struct {
		EntryVpnServer struct {
			IPAddresses []string `json:"ip_addresses"`
		}

		MultihopExitSrvID string
		ProxyType         string
		ProxyAddress      string
		ProxyPort         int
		ProxyUsername     string
		ProxyPassword     string

		Port struct {
			Port     int
			Protocol int
		}
	}
}

Connect request to establish new VPN connection

type ConnectedResp

type ConnectedResp struct {
	CommandBase
	VpnType         vpn.Type
	TimeSecFrom1970 int64
	ClientIP        string
	ServerIP        string
	ExitServerID    string
	ManualDNS       string
	IsCanPause      bool
}

ConnectedResp notifying about established connection

type DiagnosticsGeneratedResp

type DiagnosticsGeneratedResp struct {
	CommandBase
	ServiceLog     string
	ServiceLog0    string
	OpenvpnLog     string
	OpenvpnLog0    string
	EnvironmentLog string
}

DiagnosticsGeneratedResp returns info from daemon logs

type DisabledFunctionality

type DisabledFunctionality struct {
	WireGuardError string
	OpenVPNError   string
	ObfsproxyError string
}

DisabledFunctionality Some functionality can be not accessible It can happen, for example, if some external binaries not installed (e.g. obfsproxy or WireGaurd on Linux)

type Disconnect

type Disconnect struct {
	CommandBase
}

Disconnect disconnect active VPN connection

type DisconnectedResp

type DisconnectedResp struct {
	CommandBase
	Failure           bool
	Reason            DisconnectionReason //int
	ReasonDescription string
}

DisconnectedResp notifying about stopped connetion

type DisconnectionReason

type DisconnectionReason int

DisconnectionReason - disconnection reason

const (
	Unknown             DisconnectionReason = iota
	AuthenticationError DisconnectionReason = iota
	DisconnectRequested DisconnectionReason = iota
)

Disconnection reason types

type EmptyResp

type EmptyResp struct {
	CommandBase
}

EmptyResp empty response on request

type ErrorResp

type ErrorResp struct {
	CommandBase
	ErrorMessage string
}

ErrorResp response of error

type GetServers

type GetServers struct {
	CommandBase
}

GetServers request servers list

type GetVPNState

type GetVPNState struct {
	CommandBase
}

GetVPNState request daemon to provive current VPN connection state

type Hello

type Hello struct {
	CommandBase
	// connected client version
	Version string
	Secret  uint64

	// GetServersList == true - client requests to send back info about all servers
	GetServersList bool

	// GetStatus == true - client requests current status (Vpn connection, Firewal... etc.)
	GetStatus bool

	// GetConfigParams == true - client requests config parameters (user-defined OpevVPN file location ... etc.)
	GetConfigParams bool

	//	KeepDaemonAlone == false (default) - VPN disconnects when client disconnects from a daemon
	//	KeepDaemonAlone == true - do nothing when client disconnects from a daemon (if VPN is connected - do not disconnect)
	KeepDaemonAlone bool
}

Hello is an initial request

type HelloResp

type HelloResp struct {
	CommandBase
	Version           string
	Session           SessionResp
	DisabledFunctions DisabledFunctionality
}

HelloResp response on initial request

type KillSwitchGetIsPestistentResp

type KillSwitchGetIsPestistentResp struct {
	CommandBase
	IsPersistent bool
}

KillSwitchGetIsPestistentResp returns kill-switch persistance status

type KillSwitchGetStatus

type KillSwitchGetStatus struct {
	CommandBase
}

KillSwitchGetStatus get full killswitch status

type KillSwitchSetAllowLAN

type KillSwitchSetAllowLAN struct {
	CommandBase
	AllowLAN bool

	// When true - deamon returns empty response as confirmation
	// Needed for supporting old UI clients which are don't require confirmation
	Synchronously bool
}

KillSwitchSetAllowLAN enable\disable LAN acces for kill-switch

type KillSwitchSetAllowLANMulticast

type KillSwitchSetAllowLANMulticast struct {
	CommandBase
	AllowLANMulticast bool

	// When true - deamon returns empty response as confirmation
	// Needed for supporting old UI clients which are don't require confirmation
	Synchronously bool
}

KillSwitchSetAllowLANMulticast enable\disable LAN multicast acces for kill-switch

type KillSwitchSetEnabled

type KillSwitchSetEnabled struct {
	CommandBase
	IsEnabled bool
}

KillSwitchSetEnabled request to enable\disable kill-switch

type KillSwitchSetIsPersistent

type KillSwitchSetIsPersistent struct {
	CommandBase
	IsPersistent bool
}

KillSwitchSetIsPersistent request to mark kill-switch persistant

type KillSwitchStatusResp

type KillSwitchStatusResp struct {
	CommandBase
	IsEnabled        bool
	IsPersistent     bool
	IsAllowLAN       bool
	IsAllowMulticast bool
}

KillSwitchStatusResp returns kill-switch status

type PingResultType

type PingResultType struct {
	Host string
	Ping int
}

PingResultType represents information ping TTL for a host (is a part of 'PingServersResp')

type PingServers

type PingServers struct {
	CommandBase
	RetryCount int
	TimeOutMs  int
}

PingServers request to ping servers

type PingServersResp

type PingServersResp struct {
	CommandBase
	PingResults []PingResultType
}

PingServersResp returns average ping time for servers

type ServerListResp

type ServerListResp struct {
	CommandBase
	VpnServers types.ServersInfoResponse
}

ServerListResp returns list of servers

type ServiceExitingResp

type ServiceExitingResp struct {
	CommandBase
}

ServiceExitingResp service is going to exit response

type SessionDelete

type SessionDelete struct {
	CommandBase
}

SessionDelete logout from current device

type SessionNew

type SessionNew struct {
	CommandBase
	AccountID  string
	ForceLogin bool

	CaptchaID       string
	Captcha         string
	Confirmation2FA string
}

SessionNew - create new session

When force is set to true - all active sessions will be deleted prior to creating a new one if user reached session limit. Initial call to /sessin/new should always be performed with force set to false, to display special form, when sessions limit is reached. IVPN client apps have to set force to true only when customer clicks Log all other clients button.

type SessionNewResp

type SessionNewResp struct {
	CommandBase
	APIStatus       int
	APIErrorMessage string
	Session         SessionResp
	Account         preferences.AccountStatus
	RawResponse     string
}

SessionNewResp - information about created session (or error info)

type SessionResp

type SessionResp struct {
	AccountID          string
	Session            string
	WgPublicKey        string
	WgLocalIP          string
	WgKeyGenerated     int64 // Unix time
	WgKeysRegenInerval int64 // seconds
}

SessionResp information about session

func CreateSessionResp

func CreateSessionResp(s preferences.SessionStatus) SessionResp

CreateSessionResp create new session info object to send to client

type SetAlternateDNSResp

type SetAlternateDNSResp struct {
	CommandBase
	IsSuccess  bool
	ChangedDNS string
}

SetAlternateDNSResp returns status of changing DNS

type SetAlternateDns

type SetAlternateDns struct {
	CommandBase
	DNS string
}

SetAlternateDns request to set custom DNS

type SetPreference

type SetPreference struct {
	CommandBase
	Key   string
	Value string
}

SetPreference sets daemon configuration parameter

type VpnStateResp

type VpnStateResp struct {
	CommandBase
	// TODO: remove 'State' field. Use only 'StateVal'
	State               string
	StateVal            vpn.State
	StateAdditionalInfo string
}

VpnStateResp returns VPN connection state

type WGHost

type WGHost struct {
	Host      string
	PublicKey string `json:"public_key"`
	LocalIP   string `json:"local_ip"`
}

WGHost is a WireGuard host description

type WiFiAvailableNetworks

type WiFiAvailableNetworks struct {
	CommandBase
}

WiFiAvailableNetworks - get list of available WIFI networks

type WiFiAvailableNetworksResp

type WiFiAvailableNetworksResp struct {
	CommandBase
	Networks []WiFiNetworkInfo
}

WiFiAvailableNetworksResp - contains information about available WIFI networks

type WiFiCurrentNetwork

type WiFiCurrentNetwork struct {
	CommandBase
}

WiFiCurrentNetwork - request info about connected WIFI

type WiFiCurrentNetworkResp

type WiFiCurrentNetworkResp struct {
	CommandBase
	SSID              string
	IsInsecureNetwork bool
}

WiFiCurrentNetworkResp contains the information about currently connected WIFI

type WiFiNetworkInfo

type WiFiNetworkInfo struct {
	SSID string
}

WiFiNetworkInfo - information about WIFI network

type WireGuardGenerateNewKeys

type WireGuardGenerateNewKeys struct {
	CommandBase
	OnlyUpdateIfNecessary bool
}

WireGuardGenerateNewKeys - generate WG keys

type WireGuardSetKeysRotationInterval

type WireGuardSetKeysRotationInterval struct {
	CommandBase
	Interval int64
}

WireGuardSetKeysRotationInterval - change WG keys rotation interval

Jump to

Keyboard shortcuts

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