daemon

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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.

View Source
const URLVarPrefix = "DEVRUN_URL_"

URLVarPrefix starts the variable naming each service's address.

Variables

This section is empty.

Functions

func EnsureDaemon

func EnsureDaemon(socketPath string) error

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

func Run(socketPath string) error

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

func RunWithContext(ctx context.Context, socketPath string) error

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

func URLVarName(service string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL