Documentation ¶
Index ¶
- func AsciiPeerConfig(peer Peer, peerType string, server Server) (*bytes.Buffer, error)
- func GetWGPeerTemplate(peer Peer, peerType PeerType, server Server) (*bytes.Buffer, error)
- type JSONIPNet
- type JSONKey
- type Peer
- type PeerType
- type Server
- func (s *Server) AllocateIP() (net.IP, error)
- func (s *Server) AllocateIP6() (net.IP, error)
- func (s *Server) ConfigureDevice() error
- func (s *Server) CreateLink() error
- func (s *Server) DeleteLink() error
- func (s *Server) GetPeers() []wgtypes.PeerConfig
- func (s *Server) IPAllocated(IP net.IP) bool
- func (s *Server) Up() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsciiPeerConfig ¶
Types ¶
type JSONKey ¶
func GenerateJSONKey ¶
func GenerateJSONPrivateKey ¶
func (JSONKey) MarshalJSON ¶
func (*JSONKey) UnmarshalJSON ¶
type Peer ¶
type PeerType ¶
type PeerType int
PeerType is what configuration to use when generating peer config files
const ( // WGQuick is used by wg-quick to set up a peer // https://manpages.debian.org/unstable/wireguard-tools/wg-quick.8.en.html WGQuick PeerType = iota // Vyatta is used by Ubiquiti routers // https://github.com/WireGuard/wireguard-vyatta-ubnt/ Vyatta // NixOS is a declartive linux distro // https://nixos.wiki/wiki/Wireguard NixOS )
type Server ¶
type Server struct { ExternalHostname string ExternalIP net.IP ExternalIP6 net.IP ListenPort int Domain string InterfaceName string Network JSONIPNet Network6 JSONIPNet IP net.IP IP6 net.IP DNS net.IP PrivateKey JSONKey PostUp string PostDown string FallbackWGBin string Peers []Peer Networks []JSONIPNet PersistentKeepalive int }
func (*Server) AllocateIP ¶
AllocateIP finds a free IPv4 for a new Peer (sequential allocation)
func (*Server) AllocateIP6 ¶
AllocateIP6 finds a free IPv6 for a new Peer (pseudorandom allocation)
func (*Server) ConfigureDevice ¶
ConfigureDevice sets up the WG interface
func (*Server) CreateLink ¶
CreateLink sets up the WG interface and link with the correct address
func (*Server) DeleteLink ¶
DeleteLink removes the Netlink interface
func (*Server) GetPeers ¶
func (s *Server) GetPeers() []wgtypes.PeerConfig
func (*Server) IPAllocated ¶
IPAllocated checks the existing used ips and returns bool depending on if the IP is in use
Source Files ¶
Click to show internal directories.
Click to hide internal directories.