Documentation ¶
Overview ¶
Package v1alpha1 is the v1alpha1 version of the STUNner API.
Index ¶
Constants ¶
const ApiVersion string = "v1alpha1"
const DefaultAdminName = "default-admin-config"
const DefaultAuthName = "default-auth-config"
const DefaultAuthType = "plaintext"
const DefaultClusterType = "STATIC"
const DefaultLogLevel = "all:INFO"
const DefaultMaxRelayPort int = 1<<16 - 1
const DefaultMinRelayPort int = 1 << 15
const DefaultPort int = 3478
const DefaultProtocol = "udp"
const DefaultRealm = "stunner.l7mp.io"
const DefaultStunnerName = "default-stunnerd"
Variables ¶
var ( ErrRestartRequired = errors.New("Server restart required") ErrInvalidConf = errors.New("Invalid configuration") )
Functions ¶
This section is empty.
Types ¶
type AdminConfig ¶
type AdminConfig struct { // Name is the name of the server, optional Name string `json:"name,omitempty"` // LogLevel is the desired log verbosity, e.g.: "stunner:TRACE,all:INFO" LogLevel string `json:"loglevel,omitempty"` }
AdminConfig holds the administrative configuration
func (*AdminConfig) ConfigName ¶
func (req *AdminConfig) ConfigName() string
Name returns the name of the object to be configured
func (*AdminConfig) DeepEqual ¶
func (req *AdminConfig) DeepEqual(other Config) bool
DeepEqual compares two configurations
func (*AdminConfig) String ¶
func (req *AdminConfig) String() string
String stringifies the configuration
func (*AdminConfig) Validate ¶
func (req *AdminConfig) Validate() error
Validate checks a configuration and injects defaults
type AuthConfig ¶
type AuthConfig struct { // Type is the type of the STUN/TURN authentication mechanism ("plaintext" or "longterm") Type string `json:"type,omitempty"` // Realm defines the STUN/TURN realm to be used for STUNner Realm string `json:"realm,omitempty"` // Credentials specifies the authententication credentials: for "plaintext" at least the // keys "username" and "password" must be set, for "longterm" the key "secret" will hold // the shared authentication secret Credentials map[string]string `json:"credentials"` }
Auth defines the specification of the STUN/TURN authentication mechanism used by STUNner
func (*AuthConfig) ConfigName ¶
func (req *AuthConfig) ConfigName() string
Name returns the name of the object to be configured
func (*AuthConfig) DeepEqual ¶
func (req *AuthConfig) DeepEqual(other Config) bool
DeepEqual compares two configurations
func (*AuthConfig) String ¶
func (req *AuthConfig) String() string
String stringifies the configuration
func (*AuthConfig) Validate ¶
func (req *AuthConfig) Validate() error
Validate checks a configuration and injects defaults
type AuthType ¶
type AuthType int
AuthType species the type of the STUN/TURN authentication mechanism used by STUNner
func NewAuthType ¶
NewAuthType parses the authentication mechanism specification
type ClusterConfig ¶
type ClusterConfig struct { // Name is the name of the cluster Name string `json:"name"` // Type specifies the cluster address resolution policy, either STATIC or STRICT_DNS Type string `json:"type,omitempty"` // Endpoints specifies the peers that can be reached via this cluster Endpoints []string `json:"endpoints,omitempty"` }
ClusterConfig specifies a set of upstream peers STUNner can open transport relay connections to. There are two address resolution policies. For STATIC type clusters the allowed peer IP addresses are explicitly listed in the endpoint list. For STRICT_DNS type clusters the endpoinst are assumed to be proper DNS domain names. STUNner will resolve each domain name before creating a transport relay connection and allows the connection only if the peer address matches one of the IP addresses returned by the DNS resolver for one of the endpoints. This type of clusters is best used with headless Kubernetes services
func (*ClusterConfig) ConfigName ¶
func (req *ClusterConfig) ConfigName() string
Name returns the name of the object to be configured
func (*ClusterConfig) DeepEqual ¶
func (req *ClusterConfig) DeepEqual(other Config) bool
DeepEqual compares two configurations
func (*ClusterConfig) String ¶
func (req *ClusterConfig) String() string
String stringifies the configuration
func (*ClusterConfig) Validate ¶
func (req *ClusterConfig) Validate() error
Validate checks a configuration and injects defaults
type ClusterType ¶
type ClusterType int
ClusterType specifies the cluster address resolution policy
const ( ClusterTypeStatic ClusterType = iota + 1 ClusterTypeStrictDNS ClusterTypeUnknown )
func NewClusterType ¶
func NewClusterType(raw string) (ClusterType, error)
func (ClusterType) String ¶
func (l ClusterType) String() string
type Config ¶
type Config interface { // Validate checks a configuration and injects defaults Validate() error // Name returns the name of the object to be configured ConfigName() string // DeepEqual compares two configurations DeepEqual(other Config) bool // String stringifies the configuration String() string }
Config is the main interface for STUNner configuration objects
type ListenerConfig ¶
type ListenerConfig struct { // Name is the name of the listener Name string `json:"name,omitempty"` // Protocol is the transport protocol used by the listener ("UDP", "TCP", "TLS", "DTLS") Protocol string `json:"protocol,omitempty"` // PublicAddr is the Internet-facing public IP address for the listener (ignored by STUNner) PublicAddr string `json:"public_address,omitempty"` // PublicPort is the Internet-facing public port for the listener (ignored by STUNner) PublicPort int `json:"public_port,omitempty"` // Addr is the IP address for the listener Addr string `json:"address,omitempty"` // Port is the port for the listener Port int `json:"port,omitempty"` // MinRelayPort is the smallest relay port assigned for the relay connections spawned by // the listener MinRelayPort int `json:"min_relay_port,omitempty"` // MaxRelayPort is the highest relay port assigned for the relay connections spawned by the // listener MaxRelayPort int `json:"max_relay_port,omitempty"` // Cert is the TLS cert Cert string `json:"cert,omitempty"` // Key is the TLS key Key string `json:"key,omitempty"` // Routes specifies the list of Routes allowed via a listener Routes []string `json:"routes,omitempty"` }
ListenerConfig specifies a particular listener for the STUNner deamon
func (*ListenerConfig) ConfigName ¶
func (req *ListenerConfig) ConfigName() string
Name returns the name of the object to be configured
func (*ListenerConfig) DeepEqual ¶
func (req *ListenerConfig) DeepEqual(other Config) bool
DeepEqual compares two configurations
func (*ListenerConfig) String ¶
func (l *ListenerConfig) String() string
String stringifies the configuration
func (*ListenerConfig) Validate ¶
func (req *ListenerConfig) Validate() error
Validate checks a configuration and injects defaults
type ListenerProtocol ¶
type ListenerProtocol int
ListenerProtocol specifies the network protocol for a listener
const ( ListenerProtocolUDP ListenerProtocol = iota + 1 ListenerProtocolTCP ListenerProtocolTLS ListenerProtocolDTLS ListenerProtocolUnknown )
func NewListenerProtocol ¶
func NewListenerProtocol(raw string) (ListenerProtocol, error)
NewListenerProtocol parses the protocol specification
func (ListenerProtocol) String ¶
func (l ListenerProtocol) String() string
String returns a string representation of a listener protocol
type StunnerConfig ¶
type StunnerConfig struct { // ApiVersion is the version of the STUNner API implemented ApiVersion string `json:"version"` // AdminConfig holds the administrative configuration Admin AdminConfig `json:"admin,omitempty"` // Auth defines the specification of the STUN/TURN authentication mechanism used by STUNner Auth AuthConfig `json:"auth"` // Listeners defines the listeners for STUNner Listeners []ListenerConfig `json:"listeners,omitempty"` // Clusters defines the upstream endpoints to which transport peer connections can be made // through STUNner Clusters []ClusterConfig `json:"clusters,omitempty"` }
StunnerConfig configures the STUnner daemon
func (*StunnerConfig) ConfigName ¶
func (req *StunnerConfig) ConfigName() string
Name returns the name of the object to be configured
func (*StunnerConfig) DeepEqual ¶
func (req *StunnerConfig) DeepEqual(conf Config) bool
DeepEqual compares two configurations
func (*StunnerConfig) String ¶
func (req *StunnerConfig) String() string
String stringifies the configuration
func (*StunnerConfig) Validate ¶
func (req *StunnerConfig) Validate() error
Validate checks if a listener configuration is correct