HubBroker class
The brain of the Hub: authenticates peers, registers nodes, authorizes and brokers sessions, and relays session bytes between clients and nodes.
Transport-agnostic — it is driven by accepting OmnyShellConnections, so it can run over the real TLS WebSocket endpoint or an in-memory loopback in tests. The default relay strategy is the NAT-friendly tunnel: session frames are forwarded over the node's persistent connection with their channel id rewritten between the two ends.
Constructors
- HubBroker({required Authenticator authenticator, required Authorizer authorizer, NodeRegistry? registry, SessionRouter? router, AuditLog? audit, Clock clock = const SystemClock(), Duration heartbeatTimeout = const Duration(seconds: 30), void logger(String message)?, PortRange? tunnelPortRange, Object tunnelBindHost = '0.0.0.0', String tunnelPublicHost = ''})
- Creates a hub broker.
Properties
- audit → AuditLog
-
The audit log.
final
- authenticator → Authenticator
-
Authenticates node and client credentials.
final
-
Authorizes session opens.
final
- clock → Clock
-
The clock (also used by the heartbeat monitor).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heartbeatTimeout → Duration
-
How long a node may go silent before being declared offline.
final
- hubUid ↔ String?
-
This hub's deterministic UID, advertised in the challenge
helloso peers can identify and pin it. Set by OmnyShellHub at startup.getter/setter pair - logger → void Function(String message)?
-
Optional diagnostic logger.
final
- monitor → HeartbeatMonitor
-
The heartbeat monitor (exposed for manual ticking in tests).
no setter
- registry → NodeRegistry
-
The node registry.
final
- router → SessionRouter
-
The session routing table.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tunnelBindHost → Object
-
The host the Hub binds tunnel listeners to (matches the hub's own bind
host so external consumers can reach them).
final
- tunnelPortRange → PortRange?
-
The public TCP port range tunnels may bind, or
nullto disable tunneling (fail closed). Validated against specific-port requests and used for dynamic allocation.final - tunnelPublicHost → String
-
The host advertised to clients for tunnel public ports. When empty, the
client substitutes the Hub's own hostname (e.g. when the Hub binds a
wildcard address).
final
- tunnels → TunnelRegistry
-
Active tunnels (public listeners + metadata) and their in-use ports.
final
Methods
-
accept(
OmnyShellConnection connection) → void -
Accepts a newly-connected peer, issues the challenge
hello, and begins handling its frames. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
start(
) → void - Starts the liveness watchdog.
-
stop(
) → void - Stops the watchdog and closes every peer connection so nodes and clients observe the shutdown (and nodes begin reconnecting).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited