Documentation
¶
Overview ¶
Package server assembles the hub half: a registry, a tunnel endpoint peers attach to, and (optionally) a proxy endpoint that reaches them, served together under one lifecycle.
Index ¶
Constants ¶
const ( DefaultTunnelAddr = "127.0.0.1:7200" DefaultProxyAddr = "127.0.0.1:7202" )
The addresses New serves on when WithTunnel / WithProxy are not given — holt's canonical loopback ports.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface{ ApplyServer(*Server) }
Option configures a Server; every SharedOption is one too.
func WithLogger ¶
WithLogger sets the logger. Default: no logging.
func WithProxy ¶
WithProxy serves the given proxy endpoint instead of the default one on DefaultProxyAddr (see proxy.NewProxy). Nil disables the proxy entirely, for a tunnel-only process.
func WithRegistry ¶
WithRegistry supplies the registry instead of the default registry.NewRegistry(logger) — the way to set a hub id, a shared presence Directory, or a MeterProvider.
func WithTunnel ¶
WithTunnel serves the given tunnel endpoint instead of the default one on DefaultTunnelAddr (see tunnel.NewTunnel). Nil disables the tunnel entirely, for a proxy-only process.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the assembled hub: a Registry, a Tunnel endpoint peers attach to, and (optionally) a Proxy endpoint that reaches them. See the root package's Server alias for the full API story; the operator surface is Registry.
func New ¶
New assembles a hub from the options, laid over the defaults — the caller's options are just applied last, so overriding a default is passing the same option with another value. Nothing binds or serves until Run.
func (*Server) Registry ¶
Registry is the operational surface over the server's live tunnels: roster, stop, watch, and the value to build an admin service on.