wgpeer

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: AGPL-3.0 Imports: 0 Imported by: 0

README

Go Reference

wgpeer

wgpeer manages the endpoints of peers configured for a wireguard interface. It detects when handshakes with a peer do not succeed and rotates the remote endpoint between its IP reported by DNS and neighbouring addresses matching its MACs on shared links.

This project is released under GNU Affero General Public License v3.0, see LICENCE file in this repo for more info.

Documentation

Overview

Package wgpeer defines the data structures used in the configuration file of this project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// IfaceName if the wireguard interface we are managing.
	IfaceName string `json:"ifaceName"`
	// Peers is the set of peers this node wants to communicate with.
	Peers []Peer `json:"peers"`
}

Configuration is the unmarshalled form of the configuration file and contains all information of this node that are required for wgpeer.

func NewConfiguration

func NewConfiguration(ifaceName string, peers ...Peer) Configuration

NewConfiguration creates a new Configuration instance with all values set.

type Peer

type Peer struct {
	// Public is the base64 encoded WG public key.
	Public string `json:"public"`
	// DNSName is the name of the DNS AAAA RR that contains the global endpint of the peer.
	// Is refereshed continuously.
	DNSName string `json:"dnsName"`
	// MACs is the list of MAC addresses of the peer. This is used to determine if a link address
	// belongs to it. Multiple MACs may be specified in case the node connects with multiple network
	// cards (may it be with all at the same time or a single one out of the list).
	// If multiple peer addresses are found the one belonging belonging to the earlier specified MAC
	// is preferred.
	MACs []string `json:"macs"`
}

Peer defines a peer this nodes wants to connect to vai wireguard.

func NewPeer

func NewPeer(public, dnsName string, macs []string) Peer

NewPeer creates a new Peer instance object with all values set.

Directories

Path Synopsis
cmd
Package internal contains all the actual logic of the project.
Package internal contains all the actual logic of the project.

Jump to

Keyboard shortcuts

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