v1alpha3

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2024 License: MPL-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const APIVersion = "noisysockets.github.com/v1alpha3"

Variables

This section is empty.

Functions

func GetConfigByKind

func GetConfigByKind(kind string) (configtypes.Config, error)

Types

type Config

type Config struct {
	configtypes.TypeMeta `yaml:",inline"`
	// Name is the optional hostname of this peer.
	Name string `yaml:"name,omitempty"`
	// ListenPort is an optional port on which to listen for incoming packets.
	// If not specified, one will be chosen randomly.
	ListenPort uint16 `yaml:"listenPort,omitempty"`
	// PrivateKey is the private key for this peer.
	PrivateKey string `yaml:"privateKey"`
	// MTU is the maximum transmission unit size for this network.
	// If not specified, a conservative default value of 1280 will be used.
	// This is the protocol MTU, not the media MTU, so account for 32 bytes of
	// overhead per packet.
	MTU int `yaml:"mtu,omitempty"`
	// Subnet is the optional CIDR block for the network.
	Subnet *netip.Prefix `yaml:"subnet,omitempty"`
	// IPs is a list of IP addresses assigned to this peer.
	IPs []netip.Addr `yaml:"ips,omitempty"`
	// DNS is the DNS configuration for this peer.
	DNS *DNSConfig `yaml:"dns,omitempty"`
	// Routes is the routing table to use for the network.
	Routes []RouteConfig `yaml:"routes,omitempty"`
	// Peers is a list of known peers to which we can send and receive packets.
	Peers []PeerConfig `yaml:"peers,omitempty"`
}

Config is the configuration for a Noisy Sockets network. It is analogous to the configuration for a WireGuard interface.

func (*Config) GetAPIVersion

func (c *Config) GetAPIVersion() string

func (*Config) GetKind

func (c *Config) GetKind() string

func (*Config) PopulateTypeMeta

func (c *Config) PopulateTypeMeta()

type DNSConfig

type DNSConfig struct {
	// Domain is the optional default search domain to use for this network.
	// If not specified, a default value of "my.nzzy.net." will be used.
	Domain string `yaml:"domain,omitempty"`
	// Protocol is the DNS protocol to use for resolution.
	// If not specified, plain UDP will be used.
	Protocol DNSProtocol `yaml:"protocol,omitempty"`
	// Servers is a list of DNS servers to use for DNS resolution.
	Servers []types.MaybeAddrPort `yaml:"servers,omitempty"`
}

DNSConfig is the configuration for DNS resolution.

type DNSProtocol

type DNSProtocol string
const (
	DNSProtocolAuto DNSProtocol = ""
	// DNSProtocolUDP is the UDP DNS protocol.
	DNSProtocolUDP DNSProtocol = "udp"
	// DNSProtocolTCP is the TCP DNS protocol.
	DNSProtocolTCP DNSProtocol = "tcp"
	// DNSProtocolTLS is the DNS-over-TLS protocol.
	DNSProtocolTLS DNSProtocol = "tls"
)

func (*DNSProtocol) UnmarshalYAML

func (p *DNSProtocol) UnmarshalYAML(unmarshal func(any) error) error

type PeerConfig

type PeerConfig struct {
	// Name is the optional hostname of the peer.
	Name string `yaml:"name,omitempty"`
	// PublicKey is the public key of the peer.
	PublicKey string `yaml:"publicKey"`
	// Endpoint is an optional endpoint to which the peer's packets should be sent.
	// If not specified, the peers endpoint will be determined from received packets.
	Endpoint string `yaml:"endpoint,omitempty"`
	// IPs is a list of IP addresses assigned to the peer, this is optional for gateways.
	// Traffic with a source IP not in this list will be dropped.
	IPs []netip.Addr `yaml:"ips,omitempty"`
	// PersistentKeepalive is an optional interval in seconds to send keepalive packets.
	// If not specified, a default value of 25s will be used.
	PersistentKeepalive *time.Duration `yaml:"persistentKeepalive,omitempty"`
}

PeerConfig is the configuration for a known wireguard peer.

type RouteConfig

type RouteConfig struct {
	// Destinations is a CIDR block for which this route should be used.
	Destination netip.Prefix `yaml:"destination"`
	// Via is the name (or public key) of the peer to use as the gateway for this route.
	Via string `yaml:"via"`
}

RouteConfig is the configuration for a route in the routing table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL