Documentation
¶
Overview ¶
Package httpd is the net/http receiver: a single dual-stack http.Server with the full frozen route table (PLAN §3.3), per-route source-class gating, streaming base64-JSON decode straight to disk on /clip, single-flight, the long-poll endpoints, and the byte-identical response writer. It deletes the hand-rolled HTTP/1.1 parser the Swift app carried (PLAN §2.1) by using net/http.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListenKind ¶
type ListenKind int
ListenKind selects how Serve binds (PLAN §5.1, §5.7).
const ( // ListenUnixSocket is the Linux default: a 0600 unix-domain socket (PLAN §5.1). ListenUnixSocket ListenKind = iota // ListenLoopbackTCP binds 127.0.0.1:port with the token required on control // endpoints (opt-in shared-box mode, PLAN §6.2/§6.3). ListenLoopbackTCP // ListenTailscale binds the dual-stack all-interfaces TCP listener on // config.port so the box can RECEIVE Tier-1 /clip from a tailnet peer // (PLAN §5.7); /clip gated by exact-peer-IP AND token. ListenTailscale )
type Options ¶
type Options struct {
Config config.Config
Token string
Store store.ReceiveStore
Listen ListenKind
// SocketPath is the unix-socket path for ListenUnixSocket (PLAN §5.1).
SocketPath string
// PeerHost is the configured Tailscale peer host for the exact-peer /clip gate
// on ListenTailscale (PLAN §5.2). Empty for non-tailscale modes.
PeerHost string
// AppVersion is the CLI semver surfaced in /health (PLAN §3.3); values are the
// CLI's own, only the key names are frozen.
AppVersion string
// TempDir overrides the scratch directory for the streaming /clip base64 decode
// (PLAN §3.6). Empty ⇒ derive from Config.SaveDir / ResolvedSaveDir.
TempDir string
}
Options parameterizes the Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the receiver. It owns the http.Server, the single-flight gate, and the route mux. All routes are registered in routes() (PLAN §3.3).
func New ¶
New builds a Server with the route table wired. It does not bind a socket; call Serve to listen.
func (*Server) Serve ¶
Serve binds per the configured ListenKind and serves until ctx is canceled. For ListenTailscale/ListenLoopbackTCP it uses dualStackListenConfig so a single [::]:port bind serves IPv4+IPv6 (IPV6_V6ONLY cleared, PLAN §3.3). For ListenUnixSocket it binds the 0600 socket with stale-socket + uid-ownership handling (PLAN §5.1; the socket hardening is completed in M2b).
The TCP bind paths are wired here; the unix-socket hardening (stale-socket unlink, uid-ownership refusal, umask) is completed in M2b.