Documentation
¶
Overview ¶
Package forward carries TCP from a port on the control plane to a service that only listens on a target's localhost.
An agent's dev server, a database console, a noVNC desktop: all of them bind to loopback on the machine the agent runs on, which is not the machine the operator is sitting at. A path-prefix HTTP proxy breaks real applications — absolute asset paths, redirects, websockets — so this forwards the port itself, and every protocol passes through unmodified.
A forward makes a loopback-only service reachable by whoever can reach the control plane, so it is always explicit, always listed, and always temporary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFull = errors.New("no free forwarding port; stop one that is no longer needed")
ErrFull means every port in the range is taken.
Functions ¶
This section is empty.
Types ¶
type Forward ¶
type Forward struct {
ID int64 `json:"id"`
Kind string `json:"kind"` // port | desktop
Title string `json:"title"`
TargetID int64 `json:"target_id"`
TargetName string `json:"target_name"`
SessionID *int64 `json:"session_id"`
Port int `json:"port"` // on the target's loopback
ListenPort int `json:"listen_port"` // on the control plane
CreatedAt float64 `json:"created_at"`
ExpiresAt float64 `json:"expires_at"`
Conns int64 `json:"connections"` // a snapshot; the live count is conns
// Detail carries what a kind needs shown beside it, e.g. a desktop's DISPLAY.
Detail map[string]string `json:"detail,omitempty"`
// contains filtered or unexported fields
}
Forward is one open port.
type Manager ¶
type Manager struct {
BindHost string
PortLo int
PortHi int
// contains filtered or unexported fields
}
Manager owns every open forward. They live in memory: a restart closes them all, which is the right default for something that widens what is reachable.
func (*Manager) CloseAll ¶
func (m *Manager) CloseAll()
CloseAll stops everything; the server calls it on the way down.