v1alpha2

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MPL-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func GetConfigByKind

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

Types

type Config

type Config struct {
	types.TypeMeta `yaml:",inline" mapstructure:",squash"`
	// Name is the optional hostname of this peer.
	Name string `yaml:"name,omitempty" mapstructure:"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" mapstructure:"listenPort,omitempty"`
	// PrivateKey is the private key for this peer.
	PrivateKey string `yaml:"privateKey" mapstructure:"privateKey"`
	// IPs is a list of IP addresses assigned to this peer.
	IPs []string `yaml:"ips,omitempty" mapstructure:"ips,omitempty"`
	// DNS is the DNS configuration for this peer.
	DNS *DNSConfig `yaml:"dns,omitempty" mapstructure:"dns,omitempty"`
	// Routes is the routing table to use for the network.
	Routes []RouteConfig `yaml:"routes,omitempty" mapstructure:"routes,omitempty"`
	// Peers is a list of known peers to which we can send and receive packets.
	Peers []PeerConfig `yaml:"peers,omitempty" mapstructure:"peers,omitempty"`
}

Config is the configuration for a NoisySockets 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" mapstructure:"domain,omitempty"`
	// Protocol is the DNS protocol to use for resolution.
	// If not specified, plain UDP will be used.
	Protocol DNSProtocol `yaml:"protocol,omitempty" mapstructure:"protocol,omitempty"`
	// Nameservers is a list of DNS servers to use for DNS resolution.
	Nameservers []string `yaml:"nameservers,omitempty" mapstructure:"nameservers,omitempty"`
}

DNSConfig is the configuration for DNS resolution.

type DNSProtocol added in v0.22.0

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 added in v0.22.0

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" mapstructure:"name,omitempty"`
	// 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, the peers endpoint will be determined from received packets.
	Endpoint string `yaml:"endpoint,omitempty" mapstructure:"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 []string `yaml:"ips,omitempty" mapstructure:"ips,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 string `yaml:"destination" mapstructure:"destination"`
	// Via is the name (or public key) of the peer to use as the gateway for this route.
	Via string `yaml:"via" mapstructure:"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