wireguard

package
v0.0.0-...-79b3612 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroyConfig

func DestroyConfig(ifaceName string)

Types

type Client

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

func NewWireguardClient

func NewWireguardClient() (*Client, error)

NewWireguardClient creates new wireguard kernel space client.

func NewWireguardEndpoint

func NewWireguardEndpoint() (*Client, error)

func (*Client) Close

func (c *Client) Close() (err error)

func (*Client) ConfigureDevice

func (c *Client) ConfigureDevice(config DeviceConfig) error

func (*Client) DestroyDevice

func (c *Client) DestroyDevice(name string) error

func (*Client) PeerStats

func (c *Client) PeerStats(string) (Stats, error)

func (*Client) ReConfigureDevice

func (c *Client) ReConfigureDevice(config DeviceConfig) error

type DeviceConfig

type DeviceConfig struct {
	IfaceName  string    `json:"iface_name"`
	Subnet     net.IPNet `json:"subnet"`
	PrivateKey string    `json:"private_key"`
	ListenPort int       `json:"listen_port"`
	DNSPort    int       `json:"dns_port,omitempty"`
	DNS        []string  `json:"dns"`
	// Used only for unix.
	DNSScriptDir string `json:"dns_script_dir"`

	Peer         Peer `json:"peer"`
	ReplacePeers bool `json:"replace_peers,omitempty"`

	ProxyPort int `json:"proxy_port,omitempty"`
}

DeviceConfig describes wireguard device configuration.

func ConfigFactory

func ConfigFactory() (*DeviceConfig, error)

type Peer

type Peer struct {
	PublicKey              string       `json:"public_key"`
	Endpoint               *net.UDPAddr `json:"endpoint"`
	AllowedIPs             []string     `json:"allowed_i_ps"`
	KeepAlivePeriodSeconds int          `json:"keep_alive_period_seconds"`
}

Peer represents wireguard peer.

type Stats

type Stats struct {
	BytesSent     uint64    `json:"bytes_sent"`
	BytesReceived uint64    `json:"bytes_received"`
	LastHandshake time.Time `json:"last_handshake"`
}

Stats represents wireguard peer statistics information.

Jump to

Keyboard shortcuts

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