Documentation ¶
Index ¶
- type Config
- type NoisySocket
- func (s *NoisySocket) Close() error
- func (n NoisySocket) Dial(network, address string) (net.Conn, error)
- func (n NoisySocket) DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func (n NoisySocket) Listen(network, address string) (net.Listener, error)
- func (n NoisySocket) LookupHost(host string) ([]string, error)
- type PeerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name is the hostname of this socket. Name string `yaml:"name" mapstructure:"name"` // ListenPort is the public port on which this socket listens for incoming packets. ListenPort uint16 `yaml:"listenPort" mapstructure:"listenPort"` // PrivateKey is the private key for this socket. PrivateKey string `yaml:"privateKey" mapstructure:"privateKey"` // IPs is a list of IP addresses assigned to this socket. IPs []string `yaml:"ips" mapstructure:"ips"` // Peers is a list of known peers to which this socket can send and receive packets. Peers []PeerConfig `yaml:"peers" mapstructure:"peers"` }
Config is the configuration for a NoisySocket. It is analogous to the configuration for a WireGuard interface.
type NoisySocket ¶
type NoisySocket struct {
// contains filtered or unexported fields
}
NoisySocket is a noisy socket, it exposes Dial() and Listen() methods compatible with the net package.
func NewNoisySocket ¶
func NewNoisySocket(logger *slog.Logger, config *Config) (*NoisySocket, error)
NewNoisySocket creates a new NoisySocket.
func (NoisySocket) DialContext ¶
DialContext creates a network connection with a context.
func (NoisySocket) LookupHost ¶
LookupHost resolves host names (encoded public keys) to IP addresses.
type PeerConfig ¶
type PeerConfig struct { // Name is the hostname of the peer. Name string `yaml:"name" mapstructure:"name"` // PublicKey is the public key of the peer. PublicKey string `yaml:"publicKey" mapstructure:"publicKey"` // Endpoint is an optional endpoint to which the peer's packets should be sent. // If not specified, we will attempt to discover the peer's endpoint from its packets. Endpoint string `yaml:"endpoint" mapstructure:"endpoint"` // IPs is a list of IP addresses assigned to the peer. IPs []string `yaml:"ips" mapstructure:"ips"` }
PeerConfig is the configuration for a known peer.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
conn
Package conn implements WireGuard's network connections.
|
Package conn implements WireGuard's network connections. |
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. |
Click to show internal directories.
Click to hide internal directories.