Documentation
¶
Overview ¶
Package object implements the STUNner dataplane objects (Admin, Auth, Filter, Cluster, Server, Listener, Health, Metrics, Offload) and the declarative object hierarchy (the catalog).
Index ¶
- func NewAdmin(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewAuth(conf stnrv2.Config) (runtime.Object, error)
- func NewCluster(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewFilter(conf stnrv2.Config) (runtime.Object, error)
- func NewHealth(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewMetrics(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewOffload(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewServer(conf stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- func NewStunner(_ stnrv2.Config, rt *runtime.Runtime) (runtime.Object, error)
- type Admin
- func (a *Admin) Close(_ bool) error
- func (a *Admin) GetConfig() stnrv2.Config
- func (a *Admin) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (a *Admin) LogLevel() string
- func (a *Admin) Name() string
- func (a *Admin) Reconcile(conf stnrv2.Config) error
- func (a *Admin) Start() error
- func (a *Admin) Status() stnrv2.Status
- func (a *Admin) Type() runtime.ObjectType
- type Auth
- func (a *Auth) Close(_ bool) error
- func (a *Auth) GetConfig() stnrv2.Config
- func (a *Auth) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (a *Auth) Name() string
- func (a *Auth) Reconcile(conf stnrv2.Config) error
- func (a *Auth) Start() error
- func (a *Auth) Status() stnrv2.Status
- func (a *Auth) Type() runtime.ObjectType
- type Catalog
- type Cluster
- func (c *Cluster) Close(shutdown bool) error
- func (c *Cluster) Dial(ctx context.Context, local net.Addr, addr string) (api.Conn, error)
- func (c *Cluster) GetConfig() stnrv2.Config
- func (c *Cluster) Inspect(old, new stnrv2.Config, full *stnrv2.StunnerConfig) (runtime.Action, error)
- func (c *Cluster) Listen(network string, port int) (net.Listener, net.Addr, error)
- func (c *Cluster) ListenPacket(network string, port int) (net.PacketConn, net.Addr, error)
- func (c *Cluster) Name() string
- func (c *Cluster) Protocol() stnrv2.Protocol
- func (c *Cluster) Reconcile(conf stnrv2.Config) error
- func (c *Cluster) Start() error
- func (c *Cluster) Status() stnrv2.Status
- func (c *Cluster) Tag() api.Tag
- func (c *Cluster) Targets() []netip.AddrPort
- func (c *Cluster) Type() runtime.ObjectType
- type Filter
- func (f *Filter) Close(bool) error
- func (f *Filter) GetConfig() stnrv2.Config
- func (f *Filter) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (f *Filter) Match(a netip.AddrPort) (allow, matched bool)
- func (f *Filter) Name() string
- func (f *Filter) Reconcile(conf stnrv2.Config) error
- func (f *Filter) Start() error
- func (f *Filter) Status() stnrv2.Status
- func (f *Filter) Type() runtime.ObjectType
- type Health
- func (h *Health) Close(_ bool) error
- func (h *Health) GetConfig() stnrv2.Config
- func (h *Health) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (h *Health) Name() string
- func (h *Health) Reconcile(conf stnrv2.Config) error
- func (h *Health) Start() error
- func (h *Health) Status() stnrv2.Status
- func (h *Health) Type() runtime.ObjectType
- type HealthConfig
- type KindSpec
- type Listener
- func (l *Listener) Close(_ bool) error
- func (l *Listener) GetConfig() stnrv2.Config
- func (l *Listener) Inspect(old, new stnrv2.Config, full *stnrv2.StunnerConfig) (runtime.Action, error)
- func (l *Listener) Name() string
- func (l *Listener) Reconcile(conf stnrv2.Config) error
- func (l *Listener) Start() error
- func (l *Listener) Status() stnrv2.Status
- func (l *Listener) Type() runtime.ObjectType
- type Metrics
- func (m *Metrics) Close(_ bool) error
- func (m *Metrics) GetConfig() stnrv2.Config
- func (m *Metrics) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (m *Metrics) Name() string
- func (m *Metrics) Reconcile(conf stnrv2.Config) error
- func (m *Metrics) Start() error
- func (m *Metrics) Status() stnrv2.Status
- func (m *Metrics) Type() runtime.ObjectType
- type MetricsConfig
- type Offload
- func (o *Offload) Close(shutdown bool) error
- func (o *Offload) GetConfig() stnrv2.Config
- func (o *Offload) Inspect(old, new stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (o *Offload) Name() string
- func (o *Offload) Reconcile(conf stnrv2.Config) error
- func (o *Offload) Start() error
- func (o *Offload) Status() stnrv2.Status
- func (o *Offload) Type() runtime.ObjectType
- type OffloadConfig
- type Stunner
- func (s *Stunner) Close(_ bool) error
- func (s *Stunner) GetConfig() stnrv2.Config
- func (s *Stunner) Inspect(_, _ stnrv2.Config, _ *stnrv2.StunnerConfig) (runtime.Action, error)
- func (s *Stunner) Name() string
- func (s *Stunner) Reconcile(_ stnrv2.Config) error
- func (s *Stunner) Start() error
- func (s *Stunner) Status() stnrv2.Status
- func (s *Stunner) Type() runtime.ObjectType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCluster ¶
NewCluster creates a cluster object.
func NewMetrics ¶
NewMetrics creates a Metrics object.
func NewOffload ¶
NewOffload creates an Offload object.
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin holds the bits of STUNner administration that aren't carved out into Health/Metrics/Offload: Name/LogLevel/UserQuota/License.
func (*Admin) GetConfig ¶
GetConfig returns the full AdminConfig, combining the admin's own snapshot with the Health/Metrics/Offload pieces pulled from the live children. Safe for concurrent use.
func (*Admin) Type ¶
func (a *Admin) Type() runtime.ObjectType
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is an authentication policy. The servers referring to it read its live config per request through rt.AuthConfig, which loads the snapshot Reconcile publishes.
func (*Auth) Type ¶
func (a *Auth) Type() runtime.ObjectType
type Catalog ¶
type Catalog = reconciler.Catalog
func NewCatalog ¶
func NewCatalog() *Catalog
NewCatalog builds the default object catalog:
Stunner (root, singleton) +-- Admin -- Health / Metrics / Offload (singletons) +-- Auth [N from config] +-- Filter [N from config] +-- Cluster [N from config] +-- Server [N from config] +-- Listener [N from config]
The dataplane objects reference each other by name only, resolved through the runtime when a conn needs them, so each reconciles on its own: no object holds another, and none is restarted because another one is. Siblings start in this order, so the listeners, which hand conns to servers, come up last.
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is a cluster object: the router over its endpoints and the dialer that reaches them. Reconcile writes the fields under mu, the data path reads them.
func (*Cluster) Inspect ¶
func (c *Cluster) Inspect(old, new stnrv2.Config, full *stnrv2.StunnerConfig) (runtime.Action, error)
Inspect reconciles every change in place: a dialer change swaps the dialer, live conns keep theirs.
func (*Cluster) ListenPacket ¶
func (*Cluster) Reconcile ¶
Reconcile rebuilds the router, swaps the dialer on a change of its protocol, tunnel, TLS or addresses, and moves the resolver registrations of a running cluster to the new domains.
func (*Cluster) Tag ¶
Tag returns the tag of the conns the cluster's dialer makes, only the name before it has one.
func (*Cluster) Type ¶
func (c *Cluster) Type() runtime.ObjectType
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a filter config and its compiled rules, which every change replaces in place.
func (*Filter) Type ¶
func (f *Filter) Type() runtime.ObjectType
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
Health is the Object that owns the /live, /ready, /status HTTP server.
func (*Health) GetConfig ¶
GetConfig returns a copy of the live health config. Safe for concurrent use.
func (*Health) Type ¶
func (h *Health) Type() runtime.ObjectType
type HealthConfig ¶
type HealthConfig struct {
// Endpoint is the URI of the form `http://address:port` exposed for external HTTP
// health-checking. Empty endpoint == use defaults; nil pointer in AdminConfig is mapped to
// the default endpoint at extract time.
Endpoint string `json:"endpoint,omitempty"`
}
HealthConfig is the typed subconfig consumed by the Health object.
func (*HealthConfig) ConfigName ¶
func (c *HealthConfig) ConfigName() string
func (*HealthConfig) DeepCopyInto ¶
func (c *HealthConfig) DeepCopyInto(dst stnrv2.Config)
func (*HealthConfig) String ¶
func (c *HealthConfig) String() string
func (*HealthConfig) Validate ¶
func (c *HealthConfig) Validate() error
type KindSpec ¶
type KindSpec = reconciler.KindSpec
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a listener object: it accepts client conns, or dials its peer, applies the listener filters, and processes the conns via a chain of servers.
func NewListener ¶
NewListener creates the listener object of a config.
func (*Listener) Close ¶
Close closes the socket. Emitted conns stay up, except the conn of a dialing listener.
func (*Listener) Inspect ¶
func (l *Listener) Inspect(old, new stnrv2.Config, full *stnrv2.StunnerConfig) (runtime.Action, error)
Inspect restarts on a socket change (protocol, address, port, connect); the rest reconciles in place.
func (*Listener) Reconcile ¶
Reconcile applies everything but the socket to the next conns. The certificate of a running listener loads here: one that does not load fails the reconcile and keeps the previous one; a stopped listener loads it on Start.
func (*Listener) Type ¶
func (l *Listener) Type() runtime.ObjectType
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is the Object that owns the Prometheus metrics HTTP server. Carving it out of Admin makes it independently restartable.
func (*Metrics) GetConfig ¶
GetConfig returns a copy of the live metrics config. Safe for concurrent use.
func (*Metrics) Type ¶
func (m *Metrics) Type() runtime.ObjectType
type MetricsConfig ¶
type MetricsConfig struct {
Endpoint string `json:"endpoint,omitempty"`
}
MetricsConfig is the typed subconfig consumed by Metrics. An empty endpoint disables the server.
func (*MetricsConfig) ConfigName ¶
func (c *MetricsConfig) ConfigName() string
func (*MetricsConfig) DeepCopyInto ¶
func (c *MetricsConfig) DeepCopyInto(dst stnrv2.Config)
func (*MetricsConfig) String ¶
func (c *MetricsConfig) String() string
func (*MetricsConfig) Validate ¶
func (c *MetricsConfig) Validate() error
type Offload ¶
type Offload struct {
// contains filtered or unexported fields
}
Offload is the reconciliation representative of the process-wide offload engine (rt.OffloadEngine), created once at startup: an offload-config change restarts the object, whose Close closes the engine and whose Start re-pins it with the new config, while Stunner.Close closes the engine on shutdown. The object surfaces the engine statistics as status.
func (*Offload) Close ¶
Close tears the engine down. On a reconcile-driven restart (shutdown=false) the engine is closed so the following Start re-pins it; on process shutdown the engine is closed by Stunner.Close, so this is a no-op.
func (*Offload) GetConfig ¶
GetConfig returns a copy of the live offload config. Safe for concurrent use.
func (*Offload) Start ¶
Start (re-)pins the process-wide offload engine with the current config. The reconciler calls it only on object create/restart, i.e. on an actual offload-config change.
func (*Offload) Type ¶
func (o *Offload) Type() runtime.ObjectType
type OffloadConfig ¶
type OffloadConfig struct {
Engine string `json:"engine,omitempty"`
Interfaces []string `json:"interfaces,omitempty"`
}
OffloadConfig is the typed subconfig consumed by Offload.
func (*OffloadConfig) ConfigName ¶
func (c *OffloadConfig) ConfigName() string
func (*OffloadConfig) DeepCopyInto ¶
func (c *OffloadConfig) DeepCopyInto(dst stnrv2.Config)
func (*OffloadConfig) String ¶
func (c *OffloadConfig) String() string
func (*OffloadConfig) Validate ¶
func (c *OffloadConfig) Validate() error
type Stunner ¶
type Stunner struct {
// contains filtered or unexported fields
}
Stunner is the root Object of the dataplane tree. It holds no own runtime state; its job is to surface the full StunnerConfig, report live state from descendants, and provide a single node the reconciler can root its walk at.
func (*Stunner) GetConfig ¶
GetConfig pulls each top-level child's config from the registry, surfacing the running dataplane state. Children missing before the first reconcile are reported as zero values.
func (*Stunner) Inspect ¶
Inspect/Reconcile/Start/Close are no-ops at the root: it has no own state and the tree-walk handles descendants.
func (*Stunner) Status ¶
Status aggregates the children's statuses into a StunnerStatus, with the number of live sessions summed over the servers and the readiness of the runtime.
func (*Stunner) Type ¶
func (s *Stunner) Type() runtime.ObjectType