env

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package env contains common command line and initialization code for SCION services. If something is specific to one app, it should go into that app's code and not here.

During initialization, SIGHUPs are masked. To call a function on each SIGHUP, pass the function when calling Init.

Index

Constants

View Source
const (
	// TopologyFile is the file name for the topology file.
	TopologyFile = "topology.json"

	// StaticInfoConfigFile is the file name for the configuration file
	// used for the StaticInfo beacon extension.
	StaticInfoConfigFile = "staticInfoConfig.json"

	// SciondInitConnectPeriod is the default total amount of time spent
	// attempting to connect to the daemon on start.
	SciondInitConnectPeriod = 20 * time.Second

	// ShutdownGraceInterval is the time applications wait after issuing a
	// clean shutdown signal, before forcerfully tearing down the application.
	ShutdownGraceInterval = 5 * time.Second
)

Variables

View Source
var (
	// The value is generated by tools/git-version.
	StartupVersion string
)

Startup* variables are set during link time.

Functions

func LogAppStarted added in v0.4.0

func LogAppStarted(svcType, elemID string) error

LogAppStarted should be called by applications as soon as logging is initialized.

func LogAppStopped added in v0.4.0

func LogAppStopped(svcType, elemID string)

func VersionInfo added in v0.4.0

func VersionInfo() string

VersionInfo returns build version information (build date, build version, build chain).

Types

type Daemon added in v0.7.0

type Daemon struct {
	// Address of the SCION Daemon the client should connect to. Defaults to
	// 127.0.0.1:30255.
	Address string `toml:"address,omitempty"`
	// InitialConnectPeriod is the maximum amount of time spent attempting to
	// connect to the daemon on start.
	InitialConnectPeriod util.DurWrap `toml:"initial_connect_period,omitempty"`
	// FakeData can be used to replace the local daemon with a fake data source.
	// It must point to a fake daemon configuration file.
	FakeData string `toml:"fake_data,omitempty"`
}

Daemon contains information for running snet with the SCION Daemon.

func (*Daemon) ConfigName added in v0.7.0

func (cfg *Daemon) ConfigName() string

func (*Daemon) InitDefaults added in v0.7.0

func (cfg *Daemon) InitDefaults()

func (*Daemon) Sample added in v0.7.0

func (cfg *Daemon) Sample(dst io.Writer, path config.Path, _ config.CtxMap)

func (*Daemon) Validate added in v0.7.0

func (cfg *Daemon) Validate() error

type Features added in v0.4.0

type Features struct {
	config.NoDefaulter
	config.NoValidator

	// AppropriateDigest enables the CA module to sign issued certificates
	// with the appropriate digest algorithm instead of always using ECDSAWithSHA512.
	//
	// Experimental: This field is experimental and will be subject to change.
	AppropriateDigest bool `toml:"appropriate_digest_algorithm"`
}

Features contains all feature flags. Add feature flags to this structure as needed. Feature flags are always boolean. Don't use any other types here!

func (*Features) ConfigName added in v0.4.0

func (cfg *Features) ConfigName() string

func (*Features) Sample added in v0.4.0

func (cfg *Features) Sample(dst io.Writer, path config.Path, ctx config.CtxMap)

type General

type General struct {
	// ID is the SCION element ID. This is used to choose the relevant
	// portion of the topology file for some services.
	ID string `toml:"id,omitempty"`
	// ConfigDir for loading extra files (currently, only topology.json and staticInfoConfig.json)
	ConfigDir string `toml:"config_dir,omitempty"`
	// ReconnectToDispatcher can be set to true to enable transparent dispatcher
	// reconnects.
	ReconnectToDispatcher bool `toml:"reconnect_to_dispatcher,omitempty"`
}

func (*General) ConfigName added in v0.4.0

func (cfg *General) ConfigName() string

func (*General) InitDefaults added in v0.4.0

func (cfg *General) InitDefaults()

InitDefaults sets the default value for Topology if not already set.

func (*General) Sample added in v0.4.0

func (cfg *General) Sample(dst io.Writer, path config.Path, ctx config.CtxMap)

func (*General) StaticInfoConfig added in v0.6.0

func (cfg *General) StaticInfoConfig() string

StaticInfoConfig return the path to the configuration file for the StaticInfo beacon extension.

func (*General) Topology

func (cfg *General) Topology() string

Topology returns the path to the topology file

func (*General) Validate added in v0.4.0

func (cfg *General) Validate() error

type Metrics

type Metrics struct {
	config.NoDefaulter
	config.NoValidator
	// Prometheus contains the address to export prometheus metrics on. If
	// not set, metrics are not exported.
	Prometheus string `toml:"prometheus,omitempty"`
}

func (*Metrics) ConfigName added in v0.4.0

func (cfg *Metrics) ConfigName() string

func (*Metrics) Sample added in v0.4.0

func (cfg *Metrics) Sample(dst io.Writer, path config.Path, _ config.CtxMap)

func (*Metrics) ServePrometheus added in v0.7.0

func (cfg *Metrics) ServePrometheus(ctx context.Context) error

type QUIC added in v0.4.0

type QUIC struct {
	Address string `toml:"address,omitempty"`
}

QUIC contains configuration for control-plane speakers.

func (*QUIC) ConfigName added in v0.4.0

func (cfg *QUIC) ConfigName() string

func (*QUIC) Sample added in v0.4.0

func (cfg *QUIC) Sample(dst io.Writer, path config.Path, _ config.CtxMap)

type Tracing added in v0.4.0

type Tracing struct {
	// Enabled enables tracing for this service.
	Enabled bool `toml:"enabled,omitempty"`
	// Enable debug mode.
	Debug bool `toml:"debug,omitempty"`
	// Agent is the address of the local agent that handles the reported
	// traces. (default: localhost:6831)
	Agent string `toml:"agent,omitempty"`
}

Tracing contains configuration for tracing.

func (*Tracing) ConfigName added in v0.4.0

func (cfg *Tracing) ConfigName() string

func (*Tracing) InitDefaults added in v0.4.0

func (cfg *Tracing) InitDefaults()

func (*Tracing) NewTracer added in v0.4.0

func (cfg *Tracing) NewTracer(id string) (opentracing.Tracer, io.Closer, error)

NewTracer creates a new Tracer for the given configuration. In case tracing is disabled this still returns noop-objects for convenience of the caller.

func (*Tracing) Sample added in v0.4.0

func (cfg *Tracing) Sample(dst io.Writer, path config.Path, _ config.CtxMap)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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