Documentation ¶
Index ¶
- Constants
- Variables
- type Admin
- func (a *Admin) Close() error
- func (a *Admin) GetConfig() stnrv1.Config
- func (a *Admin) Inspect(old, new, full stnrv1.Config) (bool, error)
- func (a *Admin) ObjectName() string
- func (a *Admin) ObjectType() string
- func (a *Admin) Reconcile(conf stnrv1.Config) error
- func (a *Admin) Status() stnrv1.Status
- type AdminFactory
- type Auth
- func (auth *Auth) Close() error
- func (auth *Auth) GetConfig() stnrv1.Config
- func (auth *Auth) Inspect(old, new, full stnrv1.Config) (bool, error)
- func (auth *Auth) ObjectName() string
- func (a *Auth) ObjectType() string
- func (auth *Auth) Reconcile(conf stnrv1.Config) error
- func (auth *Auth) Status() stnrv1.Status
- type AuthFactory
- type Cluster
- func (c *Cluster) Close() error
- func (c *Cluster) GetConfig() stnrv1.Config
- func (c *Cluster) Inspect(old, new, full stnrv1.Config) (bool, error)
- func (c *Cluster) Match(peer net.IP, port int) bool
- func (c *Cluster) ObjectName() string
- func (c *Cluster) ObjectType() string
- func (c *Cluster) Reconcile(conf stnrv1.Config) error
- func (c *Cluster) Route(peer net.IP) bool
- func (c *Cluster) Status() stnrv1.Status
- type ClusterFactory
- type Factory
- func NewAdminFactory(dryRun bool, rc ReadinessHandler, status StatusHandler, ...) Factory
- func NewAuthFactory(logger logging.LoggerFactory) Factory
- func NewClusterFactory(resolver resolver.DnsResolver, logger logging.LoggerFactory) Factory
- func NewListenerFactory(net transport.Net, realmHandler RealmHandler, logger logging.LoggerFactory) Factory
- type Listener
- func (l *Listener) Close() error
- func (l *Listener) GetConfig() stnrv1.Config
- func (l *Listener) Inspect(old, new, full stnrv1.Config) (bool, error)
- func (l *Listener) ObjectName() string
- func (l *Listener) ObjectType() string
- func (l *Listener) Reconcile(conf stnrv1.Config) error
- func (l *Listener) Status() stnrv1.Status
- func (l *Listener) String() string
- type ListenerFactory
- type Object
- func NewAdmin(conf stnrv1.Config, dryRun bool, rc ReadinessHandler, status StatusHandler, ...) (Object, error)
- func NewAuth(conf stnrv1.Config, logger logging.LoggerFactory) (Object, error)
- func NewCluster(conf stnrv1.Config, resolver resolver.DnsResolver, ...) (Object, error)
- func NewListener(conf stnrv1.Config, net transport.Net, realmHandler RealmHandler, ...) (Object, error)
- type ReadinessHandler
- type RealmHandler
- type StatusHandler
Constants ¶
const DefaultAdminObjectName = "DefaultAdmin"
Variables ¶
var ( // ErrRestartRequired indicates that an object needs to be restarted for reconciliation. ErrRestartRequired = errors.New("Restart required") )
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
Name, LogLevel string
DryRun bool
MetricsEndpoint, HealthCheckEndpoint string
// contains filtered or unexported fields
}
Admin is the main object holding STUNner administration info.
func (*Admin) Inspect ¶ added in v0.10.5
Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).
func (*Admin) ObjectName ¶
ObjectName returns the name of the object.
func (*Admin) ObjectType ¶ added in v0.11.3
ObjectType returns the type of the object.
type AdminFactory ¶ added in v0.10.5
type AdminFactory struct {
// contains filtered or unexported fields
}
AdminFactory can create now Admin objects
type Auth ¶
type Auth struct { Type stnrv1.AuthType Realm, Username, Password, Secret string Log logging.LeveledLogger }
Auth is the STUNner authenticator
func (*Auth) Inspect ¶ added in v0.10.5
Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).
func (*Auth) ObjectName ¶
ObjectName returns the name of the object
func (*Auth) ObjectType ¶ added in v0.11.3
ObjectType returns the type of the object
type AuthFactory ¶ added in v0.10.5
type AuthFactory struct {
// contains filtered or unexported fields
}
AuthFactory can create now Auth objects
type Cluster ¶
type Cluster struct { Name string Type stnrv1.ClusterType Protocol stnrv1.ClusterProtocol Endpoints []*util.Endpoint Domains []string Resolver resolver.DnsResolver // for strict DNS // contains filtered or unexported fields }
Listener implements a STUNner cluster
func (*Cluster) Inspect ¶ added in v0.10.5
Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).
func (*Cluster) Match ¶ added in v0.16.2
Match decides whether a peer IP and port matches one of the permitted endpoints of a cluster. If port is zero then port-matching is disabled.
func (*Cluster) ObjectName ¶
ObjectName returns the name of the object.
func (*Cluster) ObjectType ¶ added in v0.11.3
ObjectType returns the type of the object.
type ClusterFactory ¶ added in v0.10.5
type ClusterFactory struct {
// contains filtered or unexported fields
}
ClusterFactory can create now Cluster objects
type Factory ¶ added in v0.10.5
type Factory interface { // New will spawn a new object from the factory. New(conf stnrv1.Config) (Object, error) }
Factory can create new objects.
func NewAdminFactory ¶ added in v0.10.5
func NewAdminFactory(dryRun bool, rc ReadinessHandler, status StatusHandler, logger logging.LoggerFactory) Factory
NewAdminFactory creates a new factory for Admin objects
func NewAuthFactory ¶ added in v0.10.5
func NewAuthFactory(logger logging.LoggerFactory) Factory
NewAuthFactory creates a new factory for Auth objects
func NewClusterFactory ¶ added in v0.10.5
func NewClusterFactory(resolver resolver.DnsResolver, logger logging.LoggerFactory) Factory
NewClusterFactory creates a new factory for Cluster objects
func NewListenerFactory ¶ added in v0.10.5
func NewListenerFactory(net transport.Net, realmHandler RealmHandler, logger logging.LoggerFactory) Factory
NewListenerFactory creates a new factory for Listener objects
type Listener ¶
type Listener struct {
Name, Realm string
Proto stnrv1.ListenerProtocol
Addr net.IP
Port, MinPort, MaxPort int
PublicAddr string // for GetConfig()
PublicPort int // for GetConfig()
Cert, Key []byte
Conns []any // either a set of turn.ListenerConfigs or turn.PacketConnConfigs
Server *turn.Server
Routes []string
Net transport.Net
// contains filtered or unexported fields
}
Listener implements a STUNner listener.
func (*Listener) Inspect ¶ added in v0.10.5
Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).
func (*Listener) ObjectName ¶
ObjectName returns the name of the object.
func (*Listener) ObjectType ¶ added in v0.11.3
ObjectType returns the type of the object.
type ListenerFactory ¶ added in v0.10.5
type ListenerFactory struct {
// contains filtered or unexported fields
}
/////////// ListenerFactory can create now Listener objects
type Object ¶
type Object interface { // ObjectName returns the name of the object. ObjectName() string // ObjectType returns the type of the object. ObjectType() string // Inspect examines whether a configuration change requires a reconciliation or restart. Inspect(old, new, full stnrv1.Config) (bool, error) // Reconcile updates the object for a new configuration. Reconcile(conf stnrv1.Config) error // GetConfig returns the configuration of the running authenticator. GetConfig() stnrv1.Config // Close closes the object, may return ErrRestartRequired. Close() error // Status returns the status of the object. Status() stnrv1.Status }
Object is the high-level interface for all STUNner objects like listeners, clusters, etc.
func NewAdmin ¶
func NewAdmin(conf stnrv1.Config, dryRun bool, rc ReadinessHandler, status StatusHandler, logger logging.LoggerFactory) (Object, error)
NewAdmin creates a new Admin object.
func NewCluster ¶
func NewCluster(conf stnrv1.Config, resolver resolver.DnsResolver, logger logging.LoggerFactory) (Object, error)
NewCluster creates a new cluster.
func NewListener ¶
func NewListener(conf stnrv1.Config, net transport.Net, realmHandler RealmHandler, logger logging.LoggerFactory) (Object, error)
NewListener creates a new listener. Requires a server restart (returns ErrRestartRequired)
type ReadinessHandler ¶ added in v0.11.3
type ReadinessHandler = func() error
ReadinessHandler is a callback that allows an object to check the readiness of STUNner.
type RealmHandler ¶ added in v0.11.3
type RealmHandler = func() string
RealmHandler is a callback that allows an object to find out the authentication realm.
type StatusHandler ¶ added in v0.17.12
StatusHandler is a callback that allows an object to obtain the status of STUNNer.