object

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAdminObjectName = "DefaultAdmin"

Variables

View Source
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) Close

func (a *Admin) Close() error

Close closes the Admin object.

func (*Admin) GetConfig

func (a *Admin) GetConfig() v1alpha1.Config

GetConfig returns the configuration of the running object.

func (*Admin) Inspect added in v0.10.5

func (a *Admin) Inspect(old, new, full v1alpha1.Config) (bool, error)

Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).

func (*Admin) ObjectName

func (a *Admin) ObjectName() string

ObjectName returns the name of the object.

func (*Admin) ObjectType added in v0.11.3

func (a *Admin) ObjectType() string

ObjectType returns the type of the object.

func (*Admin) Reconcile

func (a *Admin) Reconcile(conf v1alpha1.Config) error

Reconcile updates the authenticator for a new configuration. Requires a valid reconciliation request.

type AdminFactory added in v0.10.5

type AdminFactory struct {
	// contains filtered or unexported fields
}

AdminFactory can create now Admin objects

func (*AdminFactory) New added in v0.10.5

func (f *AdminFactory) New(conf v1alpha1.Config) (Object, error)

New can produce a new Admin object from the given configuration. A nil config will create an empty admin object (useful for creating throwaway objects for, e.g., calling Inpect)

type Auth

type Auth struct {
	Type                              v1alpha1.AuthType
	Realm, Username, Password, Secret string
	Log                               logging.LeveledLogger
}

Auth is the STUNner authenticator

func (*Auth) Close

func (auth *Auth) Close() error

Close closes the authenticator

func (*Auth) GetConfig

func (auth *Auth) GetConfig() v1alpha1.Config

GetConfig returns the configuration of the running authenticator

func (*Auth) Inspect added in v0.10.5

func (auth *Auth) Inspect(old, new, full v1alpha1.Config) (bool, error)

Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).

func (*Auth) ObjectName

func (auth *Auth) ObjectName() string

ObjectName returns the name of the object

func (*Auth) ObjectType added in v0.11.3

func (a *Auth) ObjectType() string

ObjectType returns the type of the object

func (*Auth) Reconcile

func (auth *Auth) Reconcile(conf v1alpha1.Config) error

Reconcile updates the authenticator for a new configuration.

type AuthFactory added in v0.10.5

type AuthFactory struct {
	// contains filtered or unexported fields
}

AuthFactory can create now Auth objects

func (*AuthFactory) New added in v0.10.5

func (f *AuthFactory) New(conf v1alpha1.Config) (Object, error)

New can produce a new Auth object from the given configuration. A nil config will create an empty auth object (useful for creating throwaway objects for, e.g., calling Inpect)

type Cluster

type Cluster struct {
	Name      string
	Type      v1alpha1.ClusterType
	Protocol  v1alpha1.ClusterProtocol
	Endpoints []net.IPNet
	Domains   []string
	Resolver  resolver.DnsResolver // for strict DNS
	// contains filtered or unexported fields
}

Listener implements a STUNner cluster

func (*Cluster) Close

func (c *Cluster) Close() error

Close closes the cluster.

func (*Cluster) GetConfig

func (c *Cluster) GetConfig() v1alpha1.Config

GetConfig returns the configuration of the running cluster.

func (*Cluster) Inspect added in v0.10.5

func (c *Cluster) Inspect(old, new, full v1alpha1.Config) (bool, error)

Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).

func (*Cluster) ObjectName

func (c *Cluster) ObjectName() string

ObjectName returns the name of the object.

func (*Cluster) ObjectType added in v0.11.3

func (c *Cluster) ObjectType() string

ObjectType returns the type of the object.

func (*Cluster) Reconcile

func (c *Cluster) Reconcile(conf v1alpha1.Config) error

Reconcile updates the authenticator for a new configuration.

func (*Cluster) Route

func (c *Cluster) Route(peer net.IP) bool

Route decides whwther a peer IP appears among the permitted endpoints of a cluster.

type ClusterFactory added in v0.10.5

type ClusterFactory struct {
	// contains filtered or unexported fields
}

ClusterFactory can create now Cluster objects

func (*ClusterFactory) New added in v0.10.5

func (f *ClusterFactory) New(conf v1alpha1.Config) (Object, error)

New can produce a new Cluster object from the given configuration. A nil config will create an empty cluster object (useful for creating throwaway objects for, e.g., calling Inpect)

type Factory added in v0.10.5

type Factory interface {
	// New will spawn a new object from the factory
	New(conf v1alpha1.Config) (Object, error)
}

Factory can create new objects

func NewAdminFactory added in v0.10.5

func NewAdminFactory(dryRun bool, rc health.Check, 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                  v1alpha1.ListenerProtocol
	Addr                   net.IP
	Port, MinPort, MaxPort int

	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) Close

func (l *Listener) Close() error

Close closes the TURN server that belongs to the listener.

func (*Listener) GetConfig

func (l *Listener) GetConfig() v1alpha1.Config

GetConfig returns the configuration of the running listener.

func (*Listener) Inspect added in v0.10.5

func (l *Listener) Inspect(old, new, full v1alpha1.Config) (bool, error)

Inspect examines whether a configuration change requires a reconciliation (returns true if it does) or restart (returns ErrRestartRequired).

func (*Listener) ObjectName

func (l *Listener) ObjectName() string

ObjectName returns the name of the object.

func (*Listener) ObjectType added in v0.11.3

func (l *Listener) ObjectType() string

ObjectType returns the type of the object.

func (*Listener) Reconcile

func (l *Listener) Reconcile(conf v1alpha1.Config) error

Reconcile updates a listener.

func (*Listener) String

func (l *Listener) String() string

String returns a short stable string representation of the listener, safe for applying as a key in a map.

type ListenerFactory added in v0.10.5

type ListenerFactory struct {
	// contains filtered or unexported fields
}

/////////// ListenerFactory can create now Listener objects

func (*ListenerFactory) New added in v0.10.5

func (f *ListenerFactory) New(conf v1alpha1.Config) (Object, error)

New can produce a new Listener object from the given configuration. A nil config will create an empty listener object (useful for creating throwaway objects for, e.g., calling Inpect)

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 v1alpha1.Config) (bool, error)
	// Reconcile updates the object for a new configuration.
	Reconcile(conf v1alpha1.Config) error
	// GetConfig returns the configuration of the running authenticator.
	GetConfig() v1alpha1.Config
	// Close closes the object, may return ErrRestartRequired.
	Close() error
}

Object is the high-level interface for all STUNner objects like listeners, clusters, etc.

func NewAdmin

func NewAdmin(conf v1alpha1.Config, dryRun bool, rc health.Check, logger logging.LoggerFactory) (Object, error)

NewAdmin creates a new Admin object.

func NewAuth

func NewAuth(conf v1alpha1.Config, logger logging.LoggerFactory) (Object, error)

NewAuth creates a new authenticator.

func NewCluster

func NewCluster(conf v1alpha1.Config, resolver resolver.DnsResolver, logger logging.LoggerFactory) (Object, error)

NewCluster creates a new cluster.

func NewListener

func NewListener(conf v1alpha1.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.

Jump to

Keyboard shortcuts

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