runtime

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 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 StartupTimeout

func StartupTimeout(
	base time.Duration,
	cloudflared runtimeconfig.CloudflaredSettings,
	controlPlane runtimeconfig.ControlPlaneConfig,
) time.Duration

StartupTimeout returns the Fx startup budget needed by the optional cloudflared companion. Managed mode without a configured token first fetches one from the control plane, so it receives one full poll deadline in addition to the cloudflared readiness budget.

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 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 *runtimeconfig.CloudflaredSettings) *State

NewState creates readiness state from the effective cloudflared runtimeconfig.

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.

type SupervisorParams

type SupervisorParams struct {
	fx.In

	Config                *runtimeconfig.CloudflaredSettings
	State                 *State
	Logger                *slog.Logger
	ManagedRuntimeFetcher controlplane.ManagedCloudflareTunnelFetcher `optional:"true"`
}

SupervisorParams contains the dependencies needed to construct the shared cloudflared supervisor. It is exported so the full-client compatibility package can delegate to this canonical implementation without copying it.

Jump to

Keyboard shortcuts

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