cli

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 87 Imported by: ? 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 (
	BackupDomainController  = 4
	PrimaryDomainController = 5
)

Domain controller role values from Win32_ComputerSystem https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystem

View Source
const (

	// EDNS0_OPTION_MAC is dnsmasq EDNS0 code for adding mac option.
	// https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/dns-protocol.h;h=76ac66a8c28317e9c121a74ab5fd0e20f6237dc8;hb=HEAD#l81
	// This is also dns.EDNS0LOCALSTART, but define our own constant here for clarification.
	EDNS0_OPTION_MAC = 0xFDE9
)

Variables

This section is empty.

Functions

func CheckDeactivationPin added in v1.3.5

func CheckDeactivationPin(pin int64, stopCh chan struct{}) int

CheckDeactivationPin checks if deactivation pin is valid

func ConfigureWindowsServiceFailureActions added in v1.4.0

func ConfigureWindowsServiceFailureActions(serviceName string) error

func ControlSocketName added in v1.3.6

func ControlSocketName() string

ControlSocketName returns name for control unix socket.

func FlushDNSCache added in v1.4.0

func FlushDNSCache() error

FlushDNSCache flushes the DNS cache on macOS.

func Main

func Main()

func RunCobraCommand added in v1.3.1

func RunCobraCommand(cmd *cobra.Command)

RunCobraCommand runs ctrld cli.

func RunMobile added in v1.3.1

func RunMobile(appConfig *AppConfig, appCallback *AppCallback, stopCh chan struct{})

RunMobile runs the ctrld cli on mobile platforms.

func SetMobileNameservers added in v1.5.11

func SetMobileNameservers(csv string)

SetMobileNameservers makes the comma-separated list csv the OS resolvers, and builds the OS resolver again from them. The app calls it when the network of the device changes. It is safe to call while ctrld runs. A list with no IP address keeps the current OS resolver, because a device without a network reports no nameservers. The next start replaces the list with the nameservers of its AppConfig.

func ValidateDefaultLocalIPsFromDelta added in v1.4.1

func ValidateDefaultLocalIPsFromDelta(newState *netmon.State)

ValidateDefaultLocalIPsFromDelta checks if the default local IPv4 and IPv6 stored are still present in the new network state (provided by delta.New). If a stored default IP is no longer active, it resets that default (sets it to nil) so that it won't be used in subsequent custom dialer contexts. Deprecated: retained for callers of the existing exported cli API. The network monitor uses transition-aware validation instead.

Types

type AppCallback added in v1.3.1

type AppCallback struct {
	HostName   func() string
	LanIp      func() string
	MacAddress func() string
	// Exit gets a failure line of the run. ctrld calls it before the run
	// ends, and the run does not end until Exit returns. So Exit must not
	// wait for the run to end: a wait with a timeout stalls the stop until
	// the timeout, and a wait with no timeout never ends.
	Exit func(error string)
}

AppCallback provides hooks for injecting certain functionalities from mobile platforms to main ctrld cli.

type AppConfig added in v1.3.1

type AppConfig struct {
	CdUID          string
	ProvisionID    string
	CustomHostname string
	HomeDir        string
	UpstreamProto  string
	Verbose        int
	LogPath        string
	// Dev makes ctrld use the dev API, like the --dev flag.
	Dev bool
	// MemoryLimitMiB, if more than 0, is the Go memory limit of the process.
	MemoryLimitMiB int
	// Nameservers is a comma-separated list of the OS resolvers that the app
	// reports. If it is empty, ctrld finds the OS resolvers itself. Each start
	// replaces the list that SetMobileNameservers set before it.
	Nameservers string
}

AppConfig allows overwriting ctrld cli flags from mobile platforms.

type RecoveryReason added in v1.4.0

type RecoveryReason int

RecoveryReason provides context for why we are waiting for recovery. recovery involves removing the listener IP from the interface and waiting for the upstreams to work before returning

const (
	RecoveryReasonNetworkChange RecoveryReason = iota
	RecoveryReasonRegularFailure
	RecoveryReasonOSFailure
)

Source Files

Jump to

Keyboard shortcuts

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