Documentation ¶
Index ¶
- Variables
- func OpenNetwork(logger *slog.Logger, conf *latestconfig.Config) (network.Network, error)
- type Addr
- type Conn
- type NoisySocketsNetwork
- func (net *NoisySocketsNetwork) AddPeer(peerConf latestconfig.PeerConfig) error
- func (net *NoisySocketsNetwork) AddRoute(destination netip.Prefix, viaPeerName string) error
- func (net *NoisySocketsNetwork) Close() error
- func (net *NoisySocketsNetwork) Dial(network, address string) (stdnet.Conn, error)
- func (net *NoisySocketsNetwork) DialContext(ctx context.Context, network, address string) (stdnet.Conn, error)
- func (net *NoisySocketsNetwork) GetPeer(publicKey types.NoisePublicKey) (*Peer, bool)
- func (net *NoisySocketsNetwork) HasIPv4() bool
- func (net *NoisySocketsNetwork) HasIPv6() bool
- func (net *NoisySocketsNetwork) Hostname() (string, error)
- func (net *NoisySocketsNetwork) ListPeers() []types.NoisePublicKey
- func (net *NoisySocketsNetwork) Listen(network, address string) (stdnet.Listener, error)
- func (net *NoisySocketsNetwork) ListenPacket(network, address string) (stdnet.PacketConn, error)
- func (net *NoisySocketsNetwork) LookupHost(host string) ([]string, error)
- func (net *NoisySocketsNetwork) RemovePeer(publicKey types.NoisePublicKey) error
- func (net *NoisySocketsNetwork) RemoveRoute(destination netip.Prefix) error
- type Peer
- func (p *Peer) AddAddresses(addrs ...netip.Addr)
- func (p *Peer) AddDestinationPrefixes(prefixes ...netip.Prefix)
- func (p *Peer) Addresses() []netip.Addr
- func (p *Peer) DestinationForPrefixes() []netip.Prefix
- func (p *Peer) GetEndpoint() (netip.AddrPort, error)
- func (p *Peer) Name() string
- func (p *Peer) PublicKey() types.NoisePublicKey
- func (p *Peer) RemoveAddresses(addrs ...netip.Addr)
- func (p *Peer) RemoveDestinationPrefixes(prefixes ...netip.Prefix)
- func (p *Peer) SetEndpoint(endpoint netip.AddrPort)
Constants ¶
This section is empty.
Variables ¶
var ( ErrCanceled = fmt.Errorf("operation was canceled") ErrTimeout = fmt.Errorf("i/o timeout") ErrNumericPort = fmt.Errorf("port must be numeric") ErrNoSuitableAddress = fmt.Errorf("no suitable address found") ErrMissingAddress = fmt.Errorf("missing address") ErrUnknownPeer = fmt.Errorf("unknown peer") )
var (
ErrNoEndpoint = fmt.Errorf("no known endpoint for peer")
)
Functions ¶
func OpenNetwork ¶ added in v0.18.0
OpenNetwork creates a new network using the provided configuration. The returned network is a userspace WireGuard peer that exposes Dial() and Listen() methods compatible with the net package.
Types ¶
type Addr ¶ added in v0.12.0
Addr is a wrapper around net.Addr that includes the source NoisePublicKey.
func (*Addr) PublicKey ¶ added in v0.12.0
func (a *Addr) PublicKey() types.NoisePublicKey
PublicKey returns the NoisePublicKey of the peer.
type Conn ¶ added in v0.12.0
Conn is a wrapper around net.Conn that includes the source NoisePublicKey.
func (*Conn) RemoteAddr ¶ added in v0.12.0
type NoisySocketsNetwork ¶ added in v0.10.0
type NoisySocketsNetwork struct {
// contains filtered or unexported fields
}
func (*NoisySocketsNetwork) AddPeer ¶ added in v0.15.0
func (net *NoisySocketsNetwork) AddPeer(peerConf latestconfig.PeerConfig) error
AddPeer adds a wireguard peer to the network.
func (*NoisySocketsNetwork) AddRoute ¶ added in v0.15.0
func (net *NoisySocketsNetwork) AddRoute(destination netip.Prefix, viaPeerName string) error
AddRoute adds a routing table entry for the network.
func (*NoisySocketsNetwork) Close ¶ added in v0.10.0
func (net *NoisySocketsNetwork) Close() error
func (*NoisySocketsNetwork) Dial ¶ added in v0.10.0
func (net *NoisySocketsNetwork) Dial(network, address string) (stdnet.Conn, error)
func (*NoisySocketsNetwork) DialContext ¶ added in v0.10.0
func (*NoisySocketsNetwork) GetPeer ¶ added in v0.15.0
func (net *NoisySocketsNetwork) GetPeer(publicKey types.NoisePublicKey) (*Peer, bool)
GetPeer returns a peer by its public key.
func (*NoisySocketsNetwork) HasIPv4 ¶ added in v0.10.0
func (net *NoisySocketsNetwork) HasIPv4() bool
func (*NoisySocketsNetwork) HasIPv6 ¶ added in v0.10.0
func (net *NoisySocketsNetwork) HasIPv6() bool
func (*NoisySocketsNetwork) Hostname ¶ added in v0.15.1
func (net *NoisySocketsNetwork) Hostname() (string, error)
func (*NoisySocketsNetwork) ListPeers ¶ added in v0.15.0
func (net *NoisySocketsNetwork) ListPeers() []types.NoisePublicKey
ListPeers returns a list of the public keys of all known peers.
func (*NoisySocketsNetwork) Listen ¶ added in v0.10.0
func (net *NoisySocketsNetwork) Listen(network, address string) (stdnet.Listener, error)
func (*NoisySocketsNetwork) ListenPacket ¶ added in v0.10.0
func (net *NoisySocketsNetwork) ListenPacket(network, address string) (stdnet.PacketConn, error)
func (*NoisySocketsNetwork) LookupHost ¶ added in v0.10.0
func (net *NoisySocketsNetwork) LookupHost(host string) ([]string, error)
func (*NoisySocketsNetwork) RemovePeer ¶ added in v0.15.0
func (net *NoisySocketsNetwork) RemovePeer(publicKey types.NoisePublicKey) error
RemovePeer removes a wireguard peer from the network.
func (*NoisySocketsNetwork) RemoveRoute ¶ added in v0.15.0
func (net *NoisySocketsNetwork) RemoveRoute(destination netip.Prefix) error
RemoveRoute removes a routing table entry for the network.
type Peer ¶ added in v0.15.0
Peer represents a wireguard peer in the network.
func (*Peer) AddAddresses ¶ added in v0.18.0
AddAddress adds one or more addresses to the peer.
func (*Peer) AddDestinationPrefixes ¶ added in v0.18.0
AddDestinationForPrefix adds one or more prefixes the peer is the destination for.
func (*Peer) DestinationForPrefixes ¶ added in v0.18.0
DestinationForPrefixes returns the list of prefixes the peer is the destination for.
func (*Peer) GetEndpoint ¶ added in v0.15.0
GetEndpoint returns the endpoint (public address) of the peer.
func (*Peer) PublicKey ¶ added in v0.15.0
func (p *Peer) PublicKey() types.NoisePublicKey
PublicKey returns the public key of the peer.
func (*Peer) RemoveAddresses ¶ added in v0.18.0
RemoveAddress removes one or more addresses from the peer.
func (*Peer) RemoveDestinationPrefixes ¶ added in v0.18.0
RemoveDestinationForPrefix removes one or more prefixes the peer is the destination for.
func (*Peer) SetEndpoint ¶ added in v0.15.0
SetEndpoint sets the endpoint (public address) of the peer.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
benchmark
module
|
|
examples
module
|
|
internal
|
|
conn
Package conn implements WireGuard's network connections.
|
Package conn implements WireGuard's network connections. |
dns/addrselect
Package addrselect implements RFC 6724, which describes the preferred source and destination address selection algorithm for Internet Protocol version 6 (IPv6) and Internet Protocol version 4 (IPv4).
|
Package addrselect implements RFC 6724, which describes the preferred source and destination address selection algorithm for Internet Protocol version 6 (IPv6) and Internet Protocol version 4 (IPv4). |
replay
Package replay implements an efficient anti-replay algorithm as specified in RFC 6479.
|
Package replay implements an efficient anti-replay algorithm as specified in RFC 6479. |
Package network provides an interface for the standard library's network operations.
|
Package network provides an interface for the standard library's network operations. |