Documentation ¶
Index ¶
- type AccessTokenRequest
- type Client
- func (c *Client) Connect(key wgtypes.Key) (connectResponse *ConnectResponse, err error)
- func (c *Client) Disconnect(sessionToken []byte) (err error)
- func (c *Client) GetAccessToken() (err error)
- func (c *Client) HaveAccessToken() bool
- func (c *Client) Pins(_ [][]byte, verifiedChains [][]*x509.Certificate) error
- func (c *Client) Remote() *net.TCPAddr
- func (c *Client) Resolve() (err error)
- type Config
- type ConnectRequest
- type ConnectResponse
- type DisconnectRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenRequest ¶
type AccessTokenRequest struct { Host string `json:"host,omitempty"` // VPN connection host Domain string `json:"domain,omitempty"` // VPN connection Domain AccessToken []byte `json:"accessToken,omitempty"` // Access-Token, takes precedence over Username/Password pair Username string `json:"username,omitempty"` // Username ( should be empty when updating an Access-Token ) Password string `json:"password,omitempty"` // Password ( should be empty when updating an Access-Token ) }
func (*AccessTokenRequest) Check ¶
func (a *AccessTokenRequest) Check() (err error)
type Client ¶
type Client struct { *Config // contains filtered or unexported fields }
func (*Client) Connect ¶
func (c *Client) Connect(key wgtypes.Key) (connectResponse *ConnectResponse, err error)
Hide.me "Connect" endpoint expects an ordinary POST request with a ConnectRequest JSON payload
func (*Client) Disconnect ¶
Hide.me "Disconnect" endpoint expects an ordinary POST request with a DisconnectRequest JSON payload
func (*Client) GetAccessToken ¶
Hide.me "AccessToken" endpoint expects an ordinary POST request with a AccessTokenRequest JSON payload
func (*Client) HaveAccessToken ¶
type Config ¶
type Config struct { APIVersion string `yaml:"-"` // Current API version is 1.0.0 Host string `yaml:"host,omitempty"` // FQDN of the server Port int `yaml:"port,omitempty"` // Port to connect to when issuing REST requests Domain string `yaml:"-"` // Domain ( hide.me ) AccessTokenFile string `yaml:"accessToken,omitempty"` // Access-Token for REST requests Username string `yaml:"username,omitempty"` // Username ( Access-Token takes precedence ) Password string `yaml:"password,omitempty"` // Password ( Access-Token takes precedence ) ConnectTimeout time.Duration `yaml:"connectTimeout,omitempty"` // Timeout for REST requests AccessTokenUpdateDelay time.Duration `yaml:"AccessTokenUpdateDelay,omitempty"` // Period to wait for when updating a stale Access-Token CA string `yaml:"CA,omitempty"` // CA certificate bundle ( empty for system-wide CA roots ) FirewallMark int `yaml:"firewallMark,omitempty"` // Firewall mark for the traffic generated by this app DnsServers string `yaml:"dnsServers,omitempty"` // DNS servers to use when resolving names for client requests ( wireguard link uses it's assigned DNS servers ) }
type ConnectRequest ¶
type ConnectRequest struct { Host string `json:"host,omitempty"` // VPN connection host Domain string `json:"domain,omitempty"` // VPN connection Domain AccessToken []byte `json:"accessToken,omitempty"` // Access-Token, takes precedence over Username/Password pair PublicKey []byte `json:"publicKey"` // Our public key }
func (*ConnectRequest) Check ¶
func (req *ConnectRequest) Check() (err error)
type ConnectResponse ¶
type ConnectResponse struct { PublicKey []byte `json:"publicKey"` // Server's public key Endpoint net.UDPAddr `json:"endpoint,omitempty"` // Server's endpoint PersistentKeepaliveInterval time.Duration `json:"persistentKeepalive,omitempty"` // PersistentKeepAlive interval AllowedIps []net.IP `json:"allowedIps,omitempty"` // Server assigned IPs DNS []net.IP `json:"DNS,omitempty"` // Server assigned DNS server IPs Gateway []net.IP `json:"gateway,omitempty"` // Server assigned gateway IPs StaleAccessToken bool `json:"staleAccessToken,omitempty"` // If true the Access-Token presented in the ConnectRequest is stale and should be updated SessionToken []byte `json:"sessionToken,omitempty"` // Session-Token uniquely identifies the VPN connection session }
func (*ConnectResponse) Print ¶
func (w *ConnectResponse) Print()
type DisconnectRequest ¶
type DisconnectRequest struct { Host string `json:"host,omitempty"` // VPN connection host Domain string `json:"domain,omitempty"` // VPN connection domain SessionToken []byte `json:"sessionToken,omitempty"` // Session-Token uniquely identifies the VPN connection session to disconnect }
func (*DisconnectRequest) Check ¶
func (req *DisconnectRequest) Check() (err error)
Click to show internal directories.
Click to hide internal directories.