wireguard

package
v0.0.0-...-b08a6ad Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// InterfaceName is the name of the wireguard interface to manage
	InterfaceName string
	// IP Address to assign to the interface
	IP string
	// External Port to have wireguard listen on
	ListenPort int
	// OverlayNetworks is the IP range(s) for the entire overlay network
	OverlayNetworks []net.IPNet
}

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

type Interface

type Interface interface {
	PublicKey() string
	SyncPeers(map[string]Peer) error
	GenerateSharedKey() (string, error)
}

func New

func New(config Config, logger logrus.FieldLogger) (Interface, error)

type Peer

type Peer struct {
	// PublicKey is the wireguard public key of the peer
	PublicKey string
	// SharedKey is the shared secret between the local instance and the peer
	SharedKey string
	// AllowedIP is the list of CIDR's to accept between hosts
	AllowedIP []string
	// Endpoint is the IP:Port endpoint of the peer
	Endpoint string
}

func (Peer) Equals

func (p Peer) Equals(r Peer) bool

type PeerStatus

type PeerStatus struct {
	// PublicKey is the wireguard public key of the peer
	PublicKey string
	// SharedKey is the shared secret between the local instance and the peer
	SharedKey string
	// Endpoint is the IP:Port endpoint of the peer
	Endpoint string
	// AllowedIP is a CSV of the allowed IP ranges of the peer
	AllowedIP string
	// LastHandshakeTime is the timestamp of the last handshake with the peer
	LastHandshake time.Time
	// BytesTX is the number of bytes transmitted to the peer
	BytesTX int64
	// BytesRX is the number of bytes received from the peer
	BytesRX int64
	//Keepalive is the number of second to keep the connection alive
	Keepalive int
}

func (PeerStatus) ToPeer

func (p PeerStatus) ToPeer() Peer

type Wg

type Wg interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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