Documentation ¶
Index ¶
- type Config
- type Wireguard
- func (wg *Wireguard) GetLinkStatistic() (*netlink.LinkStatistics, error)
- func (wg *Wireguard) GetPeers() (map[string]wgtypes.Peer, error)
- func (wg *Wireguard) Running() bool
- func (wg *Wireguard) SetPeer(info *types.PeerInfo) error
- func (wg *Wireguard) Shutdown() error
- func (wg *Wireguard) UnsetPeer(info *types.PeerInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Interface string `yaml:"interface" valid:"alphanum,required"` ServerIPv4 string `yaml:"server_ipv4" valid:"ipv4"` Keepalive int `yaml:"keepalive" valid:"natural,required"` Subnet validator.Subnet `yaml:"subnet" valid:"subnet,required"` DNS []string `yaml:"dns" valid:"ipv4list"` // Listen port for wireguard connections. ListenPort int `yaml:"server_port" valid:"port,required"` // NAT'ed port to access the Listen one, this one announced to the client // as part of its configuration. If not specified - `ListenPort` is used. // e.g container starts with the -p 3333:3000 option, 3000 here is ListenPort value, // so NATedPort must be set to `3333` to push the valid configuration to the client. NATedPort int `yaml:"nated_port,omitempty" valid:"port"` // PrivateKey of WireGuard, serialized to the string. // Generated automatically on the startup. PrivateKey string `yaml:"private_key"` // contains filtered or unexported fields }
func DefaultConfig ¶
func DefaultConfig() Config
func (Config) ClientPort ¶
ClientPort returns the port to announce to a client. See Config.NATedPort for details.
func (Config) GetPrivateKey ¶
func (c Config) GetPrivateKey() types.WGPrivateKey
func (Config) ServerAddr ¶
ServerAddr returns IPAddr/mask to use as a wireguard interface address.
type Wireguard ¶
type Wireguard struct {
// contains filtered or unexported fields
}
func (*Wireguard) GetLinkStatistic ¶
func (wg *Wireguard) GetLinkStatistic() (*netlink.LinkStatistics, error)
func (*Wireguard) GetPeers ¶
GetPeers returns peers configured for the underlying device. Map's key is a peer's public key string.
Click to show internal directories.
Click to hide internal directories.