Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.0.0-...-ad078e6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package cli implements the gotwamp command (SPEC §10): a thin gRPC client of gotwampd over its Unix domain socket, or over TCP with mutual TLS (--server, ADR 0010).

Index

Constants

View Source
const (
	ExitOK          = 0
	ExitFailure     = 1   // all packets lost, or a general error
	ExitUsage       = 2   // bad arguments or configuration
	ExitUnavailable = 3   // gotwampd cannot be reached
	ExitProtocol    = 4   // protocol or control error
	ExitInterrupted = 130 // SIGINT
)

Exit statuses (SPEC §10.4).

View Source
const DefaultSocket = "/run/gotwamp/gotwampd.sock"

DefaultSocket is the gotwampd API socket used without --socket or GOTWAMP_SOCKET.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, args []string, info BuildInfo, env Env) int

Main runs gotwamp with args and returns the exit status. ctx ends on SIGINT; a command it interrupts exits with ExitInterrupted.

func Run

func Run(args []string, info BuildInfo) int

Run is the gotwamp process: Main with the standard streams, SIGINT and SIGTERM, and info completed from the module build information. It returns the exit status.

Types

type BuildInfo

type BuildInfo = buildinfo.Info

BuildInfo identifies the gotwamp binary.

type Env

type Env struct {
	Stdout, Stderr io.Writer
	// Getenv reads the environment; nil means os.Getenv.
	Getenv func(string) string
	// Dial connects to gotwampd at socket; nil dials the Unix socket.
	Dial func(socket string) (*grpc.ClientConn, error)
	// Interrupt delivers SIGINT and SIGTERM. The first one stops a running
	// ping gracefully (its summary is shown) and cancels other commands;
	// the second cancels everything. Nil means no signals.
	Interrupt <-chan struct{}
}

Env is the outside world of the command.

Jump to

Keyboard shortcuts

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