Documentation
¶
Overview ¶
Package cellproxy is the metrics-emitting SOCKS5 proxy that runs inside a pr0xteus cell in place of microsocks. It proxies CONNECT through the cell's WireGuard default route while recording per-destination request counts, byte volumes, and live-connection counts, and exposes them plus a real liveness signal over a control HTTP server the controller scrapes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// CellID is this cell's own identifier (its short container ID, from the
// hostname). ParentID is the spawning controller's container ID. Both are
// echoed in /stats and tag the cell's logs for correlation.
CellID string
ParentID string
// SOCKSNetwork/SOCKSAddr are where the SOCKS5 proxy listens (the egress
// interface inside the cell).
SOCKSNetwork string
SOCKSAddr string
// ControlAddr is where the metrics + health HTTP server listens. It must be
// bound to the internal control interface only, never the egress side.
ControlAddr string
// DialTimeout bounds each outbound dial through the tunnel.
DialTimeout time.Duration
// TopDestinations caps the destination breakdown in a /stats snapshot.
TopDestinations int
}
Config is the cell proxy's runtime configuration.
func LoadConfig ¶
LoadConfig parses and validates the cell proxy environment.
type DestStat ¶
type DestStat struct {
Destination string `json:"destination"`
Requests int64 `json:"requests"`
BytesUp int64 `json:"bytesUp"`
BytesDown int64 `json:"bytesDown"`
Active int64 `json:"active"`
}
DestStat aggregates traffic for one destination host:port.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder accumulates proxy traffic metrics. It is safe for concurrent use.
func NewRecorder ¶
NewRecorder returns an empty Recorder that ranks up to topN destinations in a snapshot. A non-positive topN falls back to the destination cap.
func (*Recorder) DialFailed ¶
func (r *Recorder) DialFailed()
DialFailed records a failed outbound dial, a signal the controller uses to spot a dead tunnel without needing privileged handshake inspection.
func (*Recorder) Open ¶
Open records a new proxied request to dest and returns the bucket key later passed to Up, Down, and Close (the caller may have been folded into the overflow bucket).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server runs the SOCKS5 proxy and the control HTTP server against one shared Recorder.
type Stats ¶
type Stats struct {
Requests int64 `json:"requests"`
BytesUp int64 `json:"bytesUp"`
BytesDown int64 `json:"bytesDown"`
Active int64 `json:"active"`
DialFailures int64 `json:"dialFailures"`
Destinations []DestStat `json:"destinations"`
}
Stats is the snapshot the control server returns from GET /stats. Totals are exact; Destinations is a bounded, byte-volume-ranked slice.
type Status ¶
type Status struct {
CellID string `json:"cellId"`
ParentID string `json:"parentId,omitempty"`
StartedAt string `json:"startedAt"`
UptimeSeconds float64 `json:"uptimeSeconds"`
Traffic Stats `json:"traffic"`
}
Status is the full cell picture returned by GET /status: identity, uptime, and the traffic snapshot. GET /v1/cells/{id} on the controller proxies to it.