app

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SequenceUsage defines the usage message for the sequence flag.
	SequenceUsage = "Space separated list of hop predicates"
	// SequenceHelp defines the help message for a hop predicate sequence.
	SequenceHelp = `` /* 2196-byte string literal not displayed */

)
View Source
const LogLevelUsage = "Console logging level verbosity (debug|info|error)"

LogLevelUsage defines the usage text for the log.level flag.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode extracts the exit code from an error. If the error is nil, the exit code is zero. If the error does not wrap a CodeError, the exit code is -1.

func SIGHUPChannel

func SIGHUPChannel(ctx context.Context) chan struct{}

SIGHUPChannel returns a channel that is triggered whenever a SIGHUP signal is sent to the process. The context is used for clean up, it deregisters the SIGHUP channel and terminates the backgroun go routine on cancellation.

func SetupLog

func SetupLog(level string) error

SetupLog sets up the logging for a consol application.

func WithExitCode

func WithExitCode(err error, code int) error

WithExitCode returns an error with the exit code set.

func WithSignal

func WithSignal(ctx context.Context, sig ...os.Signal) context.Context

WithSignal derives a child context that subsribes a signal handler for the provided signals. The returned context gets cancled if any of the subscribed signals is received

Types

type ASInfo

type ASInfo struct {
	IA  addr.IA
	MTU uint16
}

ASInfo holds information about the local AS.

func QueryASInfo

func QueryASInfo(ctx context.Context, conn daemon.Connector) (ASInfo, error)

QueryASInfo queries information about the local AS from the SCION Daemon.

type Cleanup

type Cleanup []func() error

Cleanup defines a list of cleanup hooks. This can be helpful when creating an app and then adding multiple cleanup hooks and to make sure that the all execute without error.

func (*Cleanup) Add

func (c *Cleanup) Add(f func() error)

Add adds a cleanup hook that will be executed when Do is called.

func (*Cleanup) Do

func (c *Cleanup) Do() error

Do executes all the cleanup functions.

type CodeError

type CodeError struct {
	Err  error
	Code int
}

CodeError is an error that includes the exit code that should be returned.

func (CodeError) Error

func (e CodeError) Error() string

Directories

Path Synopsis
Package infraenv contains convenience function common to SCION infra services.
Package infraenv contains convenience function common to SCION infra services.
mock_infraenv
Package mock_infraenv is a generated GoMock package.
Package mock_infraenv is a generated GoMock package.
Package env contains host-wide SCION settings.
Package env contains host-wide SCION settings.
Package feature provides a simple mechanism for command line tools to take and parse feature flags.
Package feature provides a simple mechanism for command line tools to take and parse feature flags.
Package launcher includes the shared application execution boilerplate of all SCION servers.
Package launcher includes the shared application execution boilerplate of all SCION servers.
pathprobe
Package pathprobe contains methods to probe scion paths.
Package pathprobe contains methods to probe scion paths.

Jump to

Keyboard shortcuts

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