Documentation
¶
Index ¶
Constants ¶
const ( KindNamed = "named" KindQuick = "quick" )
How a tunnel was obtained, which decides what its URL is worth: a named tunnel's hostname is yours and stable, a quick one's is assigned per run and gone when it stops.
const URLVarPrefix = "DEVRUN_URL_"
URLVarPrefix starts the variable naming each service's address.
Variables ¶
This section is empty.
Functions ¶
func EnsureDaemon ¶
EnsureDaemon checks if the daemon socket is alive. If not, launches the daemon by re-execing the current binary with --_daemon and waits up to 3s.
func GatewayLogPath ¶ added in v0.5.0
func GatewayLogPath() string
GatewayLogPath is where the gateway child's stderr is kept, beside the tunnel's.
It is quiet, not silent. internal/gateway logs nothing of its own, but it sets no ErrorLog on either the http.Server or the ReverseProxy, so Go's default applies: a handler panic (with its stack, per request), a body-copy error mid-response, a superfluous WriteHeader, a write to a hijacked connection — all reach fd 2. That is why capLog bounds it: a service log grows with output its owner chose to produce, and this one does not.
This used to be a temp file, unlinked as soon as the child announced its address — which served a failure to *start* and threw away everything above, the cases with no other trace at all.
func Run ¶
Run is the daemon entry point. Called from main when --_daemon flag is detected. socketPath is the Unix socket path to listen on.
func RunWithContext ¶
RunWithContext is like Run but exits when ctx is cancelled. This is useful for in-process testing where the caller needs to stop the daemon programmatically.
func TunnelLogPath ¶ added in v0.5.0
func TunnelLogPath() string
TunnelLogPath is where cloudflared's output is kept. A file, not a pipe: the tunnel outlives this daemon on the same paths the gateway does, and a write to a pipe whose reader has gone raises SIGPIPE, which on fd 2 the Go runtime turns into a fatal signal.
func URLVarName ¶ added in v0.5.0
URLVarName is the environment variable carrying a service's address: "shop-web" becomes DEVRUN_URL_SHOP_WEB.
Anything a service name may contain but an environment variable may not — '-', '.' — becomes '_'. Names are validated elsewhere to letters, digits, '.', '_' and '-', so this covers the set.
Types ¶
This section is empty.