Documentation
¶
Overview ¶
Package wireguard manipulates wireguard interfaces
Index ¶
- Variables
- func ApplyWithoutWGQuick(nc *NCIface) error
- func DeleteOldInterface(iface string)
- func IfaceDelta(currentNode *config.Node, newNode *config.Node) bool
- func IfaceExists(ifacename string) bool
- func RemovePeer(n *config.Node, p *wgtypes.PeerConfig) error
- func RemoveWithoutWGQuick(ifacename string) error
- func SetPeers(replace bool) error
- func UpdatePeer(p *wgtypes.PeerConfig) error
- type NCIface
Constants ¶
This section is empty.
Variables ¶
var (
ErrModuleNotFound = errors.New("module not found")
)
Functions ¶
func ApplyWithoutWGQuick ¶
ApplyWithoutWGQuick - Function for running the equivalent of "wg-quick up" for linux if wg-quick is missing
func DeleteOldInterface ¶ added in v0.18.3
func DeleteOldInterface(iface string)
DeleteOldInterface - removes named interface
func IfaceDelta ¶
IfaceDelta - checks if the new node causes an interface change
func IfaceExists ¶
IfaceExists - return true if you can find the iface
func RemovePeer ¶
func RemovePeer(n *config.Node, p *wgtypes.PeerConfig) error
RemovePeer replaces a wireguard peer temporarily making public func to pass staticchecks this function will be required in future when add/delete node on server is refactored
func RemoveWithoutWGQuick ¶
RemoveWithoutWGQuick - Function for running the equivalent of "wg-quick down" for linux if wg-quick is missing
func UpdatePeer ¶
func UpdatePeer(p *wgtypes.PeerConfig) error
UpdatePeer replaces a wireguard peer temporarily making public func to pass staticchecks this function will be required in future when update node on server is refactored
Types ¶
type NCIface ¶
type NCIface struct {
Iface netIface
Name string
Addresses []ifaceAddress
MTU int
Config wgtypes.Config
}
NCIface - represents a Netclient network interface
func GetInterface ¶
func GetInterface() *NCIface
func NewNCIface ¶
NewNCIFace - creates a new Netclient interface in memory
func (*NCIface) ApplyAddrs ¶
netLink.ApplyAddrs - applies the assigned node addresses to given interface (netLink)
func (*NCIface) Create ¶
NCIface.Create - creates a linux WG interface based on a node's host config
func (*NCIface) GetPeerRoutes ¶ added in v0.18.3
func (nc *NCIface) GetPeerRoutes()
NCIface.GetPeerRoutes - fetches additional routes that are needed to be added to the interface
func (*NCIface) UpdatePeer ¶
func (n *NCIface) UpdatePeer(p wgtypes.PeerConfig)
NCIface.UpdatePeer - Updates Peers from provided PeerConfig