cloudflared

package
v0.0.11-dev Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"cloudflared",
	fx.Provide(NewState, NewSupervisor),
	fx.Invoke(registerLifecycle),
)

Module wires the optional pinned cloudflared companion into the tunnel-client lifecycle.

Functions

func BundledVersion

func BundledVersion() string

BundledVersion returns the pinned cloudflared version shipped by supported tunnel-client distributions.

func RenderStandaloneConfig

func RenderStandaloneConfig(cfg StandaloneConfig) ([]byte, error)

RenderStandaloneConfig renders a deterministic cloudflared YAML config that keeps the tunnel token out of argv and out of the config file itself.

Types

type Manifest

type Manifest struct {
	Version              string   `json:"version"`
	ReleaseURL           string   `json:"release_url"`
	ReleaseCommit        string   `json:"release_commit"`
	ModulePath           string   `json:"module_path"`
	PackagePath          string   `json:"package_path"`
	ModuleVersion        string   `json:"module_version"`
	ModuleSum            string   `json:"module_sum"`
	GoModSum             string   `json:"go_mod_sum"`
	BuildTime            string   `json:"build_time"`
	SecurityPatchOwner   string   `json:"security_patch_owner"`
	SecurityUpdatePolicy string   `json:"security_update_policy"`
	Platforms            []string `json:"platforms"`
}

Manifest is the shipped provenance and platform contract for the bundled cloudflared companion.

func BundledManifest

func BundledManifest() Manifest

BundledManifest returns the parsed, checked-in provenance manifest.

type StandaloneConfig

type StandaloneConfig struct {
	TokenFile         string
	MetricsAddress    string
	LogLevel          string
	TransportLogLevel string
	Protocol          string
	EdgeIPVersion     string
	Retries           int
	GracePeriod       time.Duration
}

StandaloneConfig is the token-free cloudflared runtime configuration emitted for operators who intentionally run cloudflared without tunnel-client.

TokenFile is a path only. The generator never reads or embeds the tunnel token, so the rendered config is safe to check into deployment manifests.

func DefaultStandaloneConfig

func DefaultStandaloneConfig(tokenFile string) StandaloneConfig

DefaultStandaloneConfig returns the reviewed production defaults for a directly supervised cloudflared process.

type State

type State struct {
	// contains filtered or unexported fields
}

State tracks whether the optional cloudflared companion is currently ready. It intentionally stores no token material.

func NewState

func NewState(cfg *config.CloudflaredConfig) *State

NewState creates readiness state from the effective cloudflared config.

func (*State) Enabled

func (s *State) Enabled() bool

Enabled reports whether this runtime requested cloudflared supervision.

func (*State) Readiness

func (s *State) Readiness() (bool, string)

Readiness returns whether cloudflared permits tunnel-client readiness and a token-safe reason when it does not.

type Supervisor

type Supervisor struct {
	// contains filtered or unexported fields
}

Supervisor owns one bundled cloudflared process for the lifetime of the tunnel-client runtime.

func NewSupervisor

func NewSupervisor(p supervisorParams) (*Supervisor, error)

NewSupervisor constructs the optional child-process supervisor.

func (*Supervisor) Failures

func (s *Supervisor) Failures() <-chan error

Failures receives one token-safe error when cloudflared exits unexpectedly. It never receives during a normal tunnel-client shutdown.

func (*Supervisor) Start

func (s *Supervisor) Start(ctx context.Context) error

Start launches the pinned companion and waits until its loopback /ready endpoint reports an active Cloudflare connection.

func (*Supervisor) Stop

func (s *Supervisor) Stop(ctx context.Context) error

Stop gracefully terminates the child, then kills it if it does not exit within the bounded shutdown grace period.

Jump to

Keyboard shortcuts

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