Documentation
¶
Index ¶
- func DefaultPIDPath() string
- func IsRunning(pid int) bool
- func ReadPID(pidPath string) (int, error)
- func ReloadDaemon(cfgPath, tunnelID, pidPath string) error
- func StartDaemon(cfgPath, tunnelID, pidPath string) (int, error)
- func StopDaemon(pidPath string) (int, error)
- func SyncTunnel(sessions map[string]*caddy.SessionInfo, ...) error
- type CloudflaredConfig
- type IngressRule
- type OriginRequest
- type TunnelCheckResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPIDPath ¶
func DefaultPIDPath() string
DefaultPIDPath returns the default path for the cloudflared PID file.
func ReadPID ¶
ReadPID reads the PID from the given file. Returns an error if the file doesn't exist or is malformed.
func ReloadDaemon ¶
ReloadDaemon restarts the cloudflared daemon so it picks up an updated config file. If the daemon is not running, this is a no-op (returns nil).
func StartDaemon ¶
StartDaemon launches cloudflared as a background process using the given config file and tunnel ID. Returns the PID of the new process. If cloudflared is already running (valid PID file), returns an error.
func StopDaemon ¶
StopDaemon sends SIGTERM to the cloudflared process identified by pidPath.
func SyncTunnel ¶
func SyncTunnel(sessions map[string]*caddy.SessionInfo, tunnelID, credentialsFile, domain, cfgPath string) error
SyncTunnel generates the cloudflared config file from current sessions. Skips if domain or tunnelID is empty.
Types ¶
type CloudflaredConfig ¶
type CloudflaredConfig struct {
Tunnel string `yaml:"tunnel"`
CredentialsFile string `yaml:"credentials-file"`
Ingress []IngressRule `yaml:"ingress"`
}
CloudflaredConfig represents the full cloudflared YAML config
type IngressRule ¶
type IngressRule struct {
Hostname string `yaml:"hostname,omitempty"`
Service string `yaml:"service"`
OriginRequest *OriginRequest `yaml:"originRequest,omitempty"`
}
IngressRule represents one cloudflared ingress rule
type OriginRequest ¶
type OriginRequest struct {
HTTPHostHeader string `yaml:"httpHostHeader,omitempty"`
}
OriginRequest holds per-rule origin connection options.
type TunnelCheckResult ¶
type TunnelCheckResult struct {
BinaryInstalled bool
TunnelExists bool
TunnelExistsError string
ConfigExists bool
ConfigValid bool
ConfigError string
IngressMismatch bool
MissingRules []string
DNSValid bool
DNSError string
}
TunnelCheckResult holds the result of a cloudflare tunnel health check
func CheckTunnel ¶
func CheckTunnel(sessions map[string]*caddy.SessionInfo, tunnelID, domain, cfgPath string) TunnelCheckResult
CheckTunnel performs a comprehensive health check of the cloudflare tunnel setup.