cmd

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: BSD-3-Clause Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "0.0.0"
)

Version variables set at build time (e.g., with -ldflags).

Functions

func Entrypoint added in v0.70.0

func Entrypoint() (*cobra.Command, error)

Entrypoint returns the root cobra command to be executed or errors if it cannot do so.

func NewGoTTYNode added in v0.69.0

func NewGoTTYNode(
	name,
	image,
	network string,
	port uint,
	username,
	password,
	shell string,
	labels map[string]string,
) clabruntime.Node

NewGoTTYNode creates a new GoTTY node configuration.

func NewSSHXNode added in v0.68.0

func NewSSHXNode(
	name,
	image,
	network,
	labName string,
	enableReaders bool,
	labels map[string]string, mountSSH bool,
) clabruntime.Node

NewSSHXNode creates a new SSHX node configuration.

func PrintContainerInspect added in v0.70.0

func PrintContainerInspect(containers []clabruntime.GenericContainer, o *Options) error

PrintContainerInspect handles non-details output (table or grouped JSON summary).

func SignalHandledContext added in v0.69.1

func SignalHandledContext() (context.Context, context.CancelFunc)

SignalHandledContext returns a context that will be canceled if a SIGINT or SIGTERM is received.

Types

type APIServerListItem added in v0.68.0

type APIServerListItem struct {
	Name    string `json:"name"`
	State   string `json:"state"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	LabsDir string `json:"labs_dir"`
	Runtime string `json:"runtime"`
	Owner   string `json:"owner"`
}

APIServerListItem defines the structure for API server container info in JSON output.

type APIServerNode added in v0.68.0

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

APIServerNode implements runtime.Node interface for API server containers.

func NewAPIServerNode added in v0.68.0

func NewAPIServerNode(name, image, labsDir string, runtime clabruntime.ContainerRuntime,
	env map[string]string, labels map[string]string,
) (*APIServerNode, error)

func (*APIServerNode) Config added in v0.68.0

func (n *APIServerNode) Config() *clabtypes.NodeConfig

func (*APIServerNode) GetEndpoints added in v0.68.0

func (*APIServerNode) GetEndpoints() []clablinks.Endpoint

GetEndpoints implementation for the Node interface.

type ConfigOptions added in v0.70.0

type ConfigOptions struct {
	TemplateVarOnly bool
}

type DeployOptions added in v0.70.0

type DeployOptions struct {
	GenerateGraph            bool
	ManagementNetworkName    string
	ManagementIPv4Subnet     net.IPNet
	ManagementIPv6Subnet     net.IPNet
	Reconfigure              bool
	MaxWorkers               uint
	SkipPostDeploy           bool
	SkipLabDirectoryFileACLs bool
	ExportTemplate           string
	LabOwner                 string
	RestoreAll               string
	RestoreNodeSnapshots     []string
}

type DestroyOptions added in v0.70.0

type DestroyOptions struct {
	Cleanup               bool
	All                   bool
	KeepManagementNetwork bool
	AutoApprove           bool
}

type EventsOptions added in v0.72.0

type EventsOptions struct {
	Format                string
	IncludeInitialState   bool
	IncludeInterfaceStats bool
	StatsInterval         time.Duration
}

type ExecOptions added in v0.70.0

type ExecOptions struct {
	Format   string
	Commands []string
}

type FilterOptions added in v0.70.0

type FilterOptions struct {
	LabelFilter []string
	NodeFilter  []string
}

type GlobalOptions added in v0.70.0

type GlobalOptions struct {
	TopologyFile     string
	VarsFile         string
	TopologyName     string
	Timeout          time.Duration
	Runtime          string
	GracefulShutdown bool
	LogLevel         string
	DebugCount       int

	// special flag that should only be set by deploy, informs the context handler to destroy
	// (or not) when root context is canceled
	CleanOnCancel bool

	// special flag that is only set on deploy,
	// if true, the topology file backup is created at /tmp/.clab/bak
	BackupTopologyFile bool
}

type GoTTYListItem added in v0.69.0

type GoTTYListItem struct {
	Name        string `json:"name"`
	Network     string `json:"network"`
	State       string `json:"state"`
	IPv4Address string `json:"ipv4_address"`
	Port        uint   `json:"port"`
	WebURL      string `json:"web_url"`
	Owner       string `json:"owner"`
}

GoTTYListItem defines the structure for GoTTY container info in JSON output.

type GraphOptions added in v0.70.0

type GraphOptions struct {
	Server           string
	Template         string
	Offline          bool
	GenerateDotFile  bool
	GenerateMermaid  bool
	MermaidDirection string
	GenerateDrawIO   bool
	DrawIOVersion    string
	DrawIOArgs       []string
	StaticDirectory  string
}

type InspectOptions added in v0.70.0

type InspectOptions struct {
	Format           string
	Details          bool
	Wide             bool
	InterfacesFormat string
	InterfacesNode   string
}

type Manager added in v0.70.0

type Manager interface {
	GetLatestVersion(ctx context.Context) *gover.Version
	DisplayNewVersionAvailable(ctx context.Context, printCurrentVersion bool)
}

Manager is the config manager interface defining the version manager methods.

type Options added in v0.70.0

type Options struct {
	Global         *GlobalOptions
	Filter         *FilterOptions
	Deploy         *DeployOptions
	Destroy        *DestroyOptions
	Config         *ConfigOptions
	Exec           *ExecOptions
	Inspect        *InspectOptions
	Graph          *GraphOptions
	Events         *EventsOptions
	ToolsAPI       *ToolsApiOptions
	ToolsCert      *ToolsCertOptions
	ToolsTxOffload *ToolsDisableTxOffloadOptions
	ToolsGoTTY     *ToolsGoTTYOptions
	ToolsNetem     *ToolsNetemOptions
	ToolsSSHX      *ToolsSSHXOptions
	ToolsVeth      *ToolsVethOptions
	ToolsVxlan     *ToolsVxlanOptions
	ToolsSnapshot  *ToolsSnapshotOptions
	Version        *VersionOptions
}

func GetOptions added in v0.70.0

func GetOptions() *Options

GetOptions returns the global options instance if it exists or creates a new one with default values for all options.

func (*Options) ToClabDestroyOptions added in v0.70.0

func (o *Options) ToClabDestroyOptions() []clabcore.DestroyOption

func (*Options) ToClabOptions added in v0.70.0

func (o *Options) ToClabOptions() []clabcore.ClabOption

type SSHXListItem added in v0.68.0

type SSHXListItem struct {
	Name        string `json:"name"`
	Network     string `json:"network"`
	State       string `json:"state"`
	IPv4Address string `json:"ipv4_address"`
	Link        string `json:"link"`
	Owner       string `json:"owner"`
}

SSHXListItem defines the structure for SSHX container info in JSON output.

type SnapshotCollection added in v0.72.0

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

SnapshotCollection aggregates results from multiple node snapshot operations.

func NewSnapshotCollection added in v0.72.0

func NewSnapshotCollection() *SnapshotCollection

NewSnapshotCollection creates a new snapshot collection.

func (*SnapshotCollection) Add added in v0.72.0

func (sc *SnapshotCollection) Add(result *SnapshotResult)

Add adds a snapshot result to the collection.

func (*SnapshotCollection) Summary added in v0.72.0

func (sc *SnapshotCollection) Summary() string

Summary returns a summary string of the snapshot operations.

type SnapshotResult added in v0.72.0

type SnapshotResult struct {
	NodeName     string
	Status       string // "success", "failed", "skipped"
	SnapshotPath string
	SizeBytes    int64
	Duration     time.Duration
	Error        error
	Reason       string
}

SnapshotResult represents the result of a snapshot operation for one node.

type ToolsApiOptions added in v0.70.0

type ToolsApiOptions struct {
	Image          string
	Name           string
	Port           uint
	Host           string
	LabsDirectory  string
	JWTSecret      string
	JWTExpiration  string
	UserGroup      string
	SuperUserGroup string
	LogLevel       string
	GinMode        string
	TrustedProxies string
	TLSEnable      bool
	TLSCertFile    string
	TLSKeyFile     string
	SSHBasePort    uint
	SSHMaxPort     uint
	Owner          string
	OutputFormat   string
}

type ToolsCertOptions added in v0.70.0

type ToolsCertOptions struct {
	CommonName       string
	Country          string
	Locality         string
	Organization     string
	OrganizationUnit string
	Expiry           string
	Path             string
	CANamePrefix     string
	CertNamePrefix   string
	CertHosts        []string
	CACertPath       string
	CAKeyPath        string
	KeySize          uint
}

type ToolsDisableTxOffloadOptions added in v0.70.0

type ToolsDisableTxOffloadOptions struct {
	ContainerName string
}

type ToolsGoTTYOptions added in v0.70.0

type ToolsGoTTYOptions struct {
	ContainerName string
	Port          uint
	Username      string
	Password      string
	Shell         string
	Image         string
	Format        string
	Owner         string
}

type ToolsNetemOptions added in v0.70.0

type ToolsNetemOptions struct {
	ContainerName string
	Interface     string
	Delay         time.Duration
	Jitter        time.Duration
	Loss          float64
	Rate          uint64
	Corruption    float64
	Format        string
}

type ToolsSSHXOptions added in v0.70.0

type ToolsSSHXOptions struct {
	ContainerName string
	EnableReaders bool
	Image         string
	Owner         string
	MountSSHDir   bool
	Format        string
}

type ToolsSnapshotOptions added in v0.72.0

type ToolsSnapshotOptions struct {
	OutputDir     string
	Format        string
	Timeout       time.Duration
	MaxConcurrent int
}

type ToolsVethOptions added in v0.70.0

type ToolsVethOptions struct {
	AEndpoint string
	BEndpoint string
	MTU       int
}

type ToolsVxlanOptions added in v0.70.0

type ToolsVxlanOptions struct {
	Link           string
	ID             uint
	MTU            uint
	DstPort        uint
	SrcPort        uint
	Remote         string
	ParentDevice   string
	DeletionPrefix string
}

type VersionOptions added in v0.70.0

type VersionOptions struct {
	Short bool
	JSON  bool
}

Jump to

Keyboard shortcuts

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