Documentation ¶
Index ¶
- Constants
- func New(name string, mtu uint) (int, bool, error)
- type Conf
- type Endpoint
- func (e *Endpoint) DNS() string
- func (e *Endpoint) Equal(b *Endpoint, dnsFirst bool) bool
- func (e *Endpoint) HasDNS() bool
- func (e *Endpoint) IP() net.IP
- func (e *Endpoint) Port() int
- func (e *Endpoint) Ready() bool
- func (e *Endpoint) Resolved() bool
- func (e *Endpoint) String() string
- func (e *Endpoint) StringOpt(dnsFirst bool) string
- func (e *Endpoint) UDPAddr(resolve bool) (*net.UDPAddr, error)
- type Peer
Constants ¶
const DefaultMTU = 1420
DefaultMTU is the the default MTU used by WireGuard.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conf ¶
type Conf struct { wgtypes.Config // The Peers field is shadowed because every Peer needs the Endpoint field that contains a DNS endpoint. Peers []Peer }
Conf represents a WireGuard configuration file.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint represents a WireGuard endpoint.
func NewEndpoint ¶
NewEndpoint returns an Endpoint from a net.IP and port.
func NewEndpointFromUDPAddr ¶
NewEndpointFromUDPAddr returns an Endpoint from a net.UDPAddr.
func ParseEndpoint ¶
ParseEndpoint returns an Endpoint from a string. The input should look like "10.0.0.0:100", "[ff10::10]:100" or "example.com:100".
func (*Endpoint) Equal ¶
Equal will return true, if the Enpoints are equal. If dnsFirst is false, the DN will only be compared if the IPs are nil.
func (*Endpoint) Ready ¶
Ready return true, if the Enpoint is ready. Ready means that an IP or DN and port exists.
func (*Endpoint) Resolved ¶
Resolved returns true, if the DN of the Endpoint was resolved or if the Endpoint has a resolved endpoint.
func (*Endpoint) String ¶
String will return the endpoint as a string. If a DN exists, it will take prcedence over the resolved endpoint.
type Peer ¶
type Peer struct { wgtypes.PeerConfig Endpoint *Endpoint }
Peer represents a `peer` section of a WireGuard configuration.
func (*Peer) DeduplicateIPs ¶
func (p *Peer) DeduplicateIPs()
DeduplicateIPs eliminates duplicate allowed IPs.