pia

package
v0.0.0-...-28073d4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddedKey

type AddedKey struct {
	Status          string   `json:"status"`
	ServerKey       string   `json:"server_key"`
	ServerPort      int      `json:"server_port"`
	ServerIP        string   `json:"server_ip"`
	ServerVirtualIP string   `json:"server_vip"`
	PeerIP          string   `json:"peer_ip"`
	PeerPublicKey   string   `json:"peer_pubkey"`
	DNSServers      []string `json:"dns_servers"`
}

type Client

type Client struct {
	HTTPClient    *http.Client
	HTTPTransport *http.Transport
}

func NewClient

func NewClient() (*Client, error)

func (*Client) CreateWireGuardConfig

func (c *Client) CreateWireGuardConfig(username, password string, servers map[string]Server) (string, error)

func (*Client) Servers

func (c *Client) Servers(withLatency bool, maxLatency time.Duration) (*Servers, error)

Servers returns structure with regions to connect; also supports withLatency option to calculate latency for each server and automatically sort them by it; set maxLatency to 0 to return all possible servers

type ContextKey

type ContextKey string

type Group

type Group []struct {
	Name  string `json:"name"`
	Ports []int  `json:"ports"`
}

type Region

type Region struct {
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	Country        string            `json:"country"`
	AutoRegion     bool              `json:"auto_region"`
	DNS            string            `json:"dns"`
	PortForwarding bool              `json:"port_forward"`
	Geo            bool              `json:"geo"`
	Servers        map[string]Server `json:"servers"`
	Latency        *time.Duration    `json:"latency"`
}

type Server

type Server []struct {
	IP         net.IP `json:"ip"`
	CommonName string `json:"cn"`
}

type Servers

type Servers struct {
	Groups  map[string]Group `json:"groups"`
	Regions []*Region        `json:"regions"`
}

Jump to

Keyboard shortcuts

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