Documentation
¶
Overview ¶
Package subhost is the intake of a subscription host (design/adr/0018-panel-behind-nat.md): it takes the connections the front of TCP 443 hands it for the subscription names and passes each, untouched, to the panel through the public bridge. A connection it cannot pass goes to the node's site (the front's default route), never to a reset, which would tell a prober the name is handled apart. Authenticated agents use a separate control bridge.
Index ¶
Constants ¶
const ( RelaySub = "sub" RelayLink = "link" )
The relay ids of the panel's two targets (its listener takes both; the host counts them apart).
Variables ¶
This section is empty.
Functions ¶
func AgentPath ¶
AgentPath derives the path used by remote agents after they prove their TLS identity.
func ControlCapacity ¶
ControlCapacity budgets one session per agent plus space for reconnects and enrollment.
func ControlPath ¶
ControlPath derives the private bridge path the panel uses to carry agent links.
Types ¶
type Entry ¶
type Entry interface {
Connected(exitID string) bool
Attach(ctx context.Context, exitID string, c bridge.Client) error
DialExit(ctx context.Context, exitID, relayID string, idle time.Duration) (net.Conn, error)
}
Entry is what the intake needs of the host's bridge entry (*bridge.Entry).
type Intake ¶
type Intake struct {
// contains filtered or unexported fields
}
Intake serves one route of a front. It is safe for concurrent use.
func (*Intake) Close ¶
func (in *Intake) Close()
Close ends the intake: the streams it carries are cut (their people reconnect, to the site or to a new host) and it waits for them.
func (*Intake) DialLink ¶
DialLink opens an authenticated agent's link to the panel through the dedicated control bridge. Only the host's own agent and peers whose TLS proof was verified can use it.
func (*Intake) Serve ¶
Serve accepts from ln until it is closed or the intake is. While the panel holds no connection the route is down: the front sends the subscription names to the site at once, without waiting for a pair.
func (*Intake) SetControlCapacity ¶
SetControlCapacity updates admission for new streams. Established streams are not evicted.
type Limits ¶
type Limits struct {
Subscriptions int // public subscriptions carried at once
Links int // authenticated agent links carried at once
SubPerSource int // subscriptions carried at once from one address (an IPv6 one by its /64)
// SubPerNetwork: subscriptions carried at once from one network, an IPv4 /24 or an IPv6 /48, so that a few dozen
// addresses of one network cannot fill the subscription class. 0 = no such bound.
SubPerNetwork int
// SoftFrom: the per-source and per-network subscription caps apply only once this many subscriptions are carried
// (about 75% of the class), so that a prober cannot make the host switch a name to the site with a few dozen
// connections. 0 = they always apply.
SoftFrom int
// QueueWait: up to maxSubQueued over-limit connections can wait this long (at most two seconds).
QueueWait time.Duration
SubIdle time.Duration
LinkIdle time.Duration // agents ping every 20 s
}
Limits are the intake's bounds for the independent public and control bridges.