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

Documentation

Index

Constants

View Source
const (
	// CodeSuccess - success
	CodeSuccess int = 200

	// Unauthorized - Invalid Credentials	(Username or Password is not valid)
	Unauthorized int = 401

	// WGPublicKeyNotFound - WireGuard Public Key not found
	WGPublicKeyNotFound int = 424

	// SessionNotFound - Session not found Session not found
	SessionNotFound int = 601

	// CodeSessionsLimitReached - You've reached the session limit, log out from other device
	CodeSessionsLimitReached int = 602

	// AccountNotActive - account should be purchased
	AccountNotActive int = 702
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ErrorCode int
	Message   string
}

APIError - error, user not logged in into account

func CreateAPIError

func CreateAPIError(errorCode int, message string) APIError

CreateAPIError creates new API error object

func (APIError) Error

func (e APIError) Error() string

type APIErrorResponse

type APIErrorResponse struct {
	APIResponse
	Message string `json:"message,omitempty"` // Text description of the message
}

APIErrorResponse generic IVPN API error

type APIResponse

type APIResponse struct {
	Status int `json:"status"` // status code
}

APIResponse - generic API response

type AntitrackerInfo

type AntitrackerInfo struct {
	Default  DNSInfo `json:"default"`
	Hardcore DNSInfo `json:"hardcore"`
}

AntitrackerInfo all info about antitracker DNSs

type ConfigInfo

type ConfigInfo struct {
	Antitracker AntitrackerInfo `json:"antitracker"`
	API         InfoAPI         `json:"api"`
}

ConfigInfo contains different configuration info (Antitracker, API ...)

type DNSInfo

type DNSInfo struct {
	IP         string `json:"ip"`
	MultihopIP string `json:"multihop-ip"`
}

DNSInfo contains info about DNS server

type GeoLookupResponse

type GeoLookupResponse struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

GeoLookupResponse geolocation info

type InfoAPI

type InfoAPI struct {
	IPAddresses []string `json:"ips"`
}

InfoAPI contains API IP adresses

type OpenvpnServerInfo

type OpenvpnServerInfo struct {
	Gateway     string `json:"gateway"`
	CountryCode string `json:"country_code"`
	Country     string `json:"country"`
	City        string `json:"city"`

	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`

	IPAddresses []string `json:"ip_addresses"`
}

OpenvpnServerInfo contains all info about OpenVPN server

type ServersInfoResponse

type ServersInfoResponse struct {
	WireguardServers []WireGuardServerInfo `json:"wireguard"`
	OpenvpnServers   []OpenvpnServerInfo   `json:"openvpn"`
	Config           ConfigInfo            `json:"config"`
}

ServersInfoResponse all info from servers.json

type ServiceStatusAPIResp

type ServiceStatusAPIResp struct {
	Active         bool     `json:"is_active"`
	ActiveUntil    int64    `json:"active_until"`
	CurrentPlan    string   `json:"current_plan"`
	PaymentMethod  string   `json:"payment_method"`
	IsRenewable    bool     `json:"is_renewable"`
	WillAutoRebill bool     `json:"will_auto_rebill"`
	IsFreeTrial    bool     `json:"is_on_free_trial"`
	Capabilities   []string `json:"capabilities"`
	Upgradable     bool     `json:"upgradable"`
	UpgradeToPlan  string   `json:"upgrade_to_plan"`
	UpgradeToURL   string   `json:"upgrade_to_url"`
	Limit          int      `json:"limit"` // applicable for 'session limit' error
}

ServiceStatusAPIResp account info

type SessionDeleteRequest

type SessionDeleteRequest struct {
	Session string `json:"session_token"`
}

SessionDeleteRequest request to delete session

type SessionNewErrorLimitResponse

type SessionNewErrorLimitResponse struct {
	APIErrorResponse
	SessionLimitData ServiceStatusAPIResp `json:"data"`
}

SessionNewErrorLimitResponse information about session limit error

type SessionNewRequest

type SessionNewRequest struct {
	AccountID  string `json:"username"`
	PublicKey  string `json:"wg_public_key"`
	ForceLogin bool   `json:"force"`

	CaptchaID       string `json:"captcha_id,omitempty"`
	Captcha         string `json:"captcha,omitempty"`
	Confirmation2FA string `json:"confirmation,omitempty"`
}

SessionNewRequest request to create new session

type SessionNewResponse

type SessionNewResponse struct {
	APIErrorResponse
	Token       string `json:"token"`
	VpnUsername string `json:"vpn_username"`
	VpnPassword string `json:"vpn_password"`

	CaptchaID    string `json:"captcha_id"`
	CaptchaImage string `json:"captcha_image"`

	ServiceStatus ServiceStatusAPIResp `json:"service_status"`

	WireGuard struct {
		Status    int    `json:"status"`
		Message   string `json:"message,omitempty"`
		IPAddress string `json:"ip_address,omitempty"`
	} `json:"wireguard"`
}

SessionNewResponse information about created session

type SessionStatusRequest

type SessionStatusRequest struct {
	Session string `json:"session_token"`
}

SessionStatusRequest request to get session status

type SessionStatusResponse

type SessionStatusResponse struct {
	APIErrorResponse
	ServiceStatus ServiceStatusAPIResp `json:"service_status"`
}

SessionStatusResponse session status response

type SessionWireGuardKeySetRequest

type SessionWireGuardKeySetRequest struct {
	Session            string `json:"session_token"`
	PublicKey          string `json:"public_key"`
	ConnectedPublicKey string `json:"connected_public_key"`
}

SessionWireGuardKeySetRequest request to set new WK key for a session

type SessionsWireGuardResponse

type SessionsWireGuardResponse struct {
	APIErrorResponse
	IPAddress string `json:"ip_address,omitempty"`
}

SessionsWireGuardResponse Sessions WireGuard response

type WireGuardServerHostInfo

type WireGuardServerHostInfo struct {
	Hostname  string `json:"hostname"`
	Host      string `json:"host"`
	PublicKey string `json:"public_key"`
	LocalIP   string `json:"local_ip"`
}

WireGuardServerHostInfo contains info about WG server host

type WireGuardServerInfo

type WireGuardServerInfo struct {
	Gateway     string `json:"gateway"`
	CountryCode string `json:"country_code"`
	Country     string `json:"country"`
	City        string `json:"city"`

	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`

	Hosts []WireGuardServerHostInfo `json:"hosts"`
}

WireGuardServerInfo contains all info about WG server

Jump to

Keyboard shortcuts

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