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
- func GetBindSnetAddress(ia addr.IA, topoAddr *topology.TopoAddr) *snet.Addr
- func GetPublicSnetAddress(ia addr.IA, topoAddr *topology.TopoAddr) *snet.Addr
- func InitGeneral(cfg *General) error
- func InitLogging(cfg *Logging) error
- type Env
- type General
- type Infra
- type Logging
- type Metrics
- type Trust
Constants ¶
View Source
const ( DefaultLoggingLevel = "info" // Default max size of log files in MiB DefaultLoggingFileSize = 50 // Default max age of log file in days DefaultLoggingFileMaxAge = 7 // Default file name for topology file (only the last element of the path) DefaultTopologyPath = "topology.json" )
Variables ¶
This section is empty.
Functions ¶
func GetBindSnetAddress ¶ added in v0.3.0
func GetPublicSnetAddress ¶ added in v0.3.0
func InitGeneral ¶
func InitLogging ¶
InitLogging initializes logging and sets the root logger Log.
Types ¶
type Env ¶
type Env struct { // AppShutdownSignal is closed when the process receives a signal to close // (e.g., SIGTERM). AppShutdownSignal chan struct{} }
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 // ConfigDir for loading extra files (currently, only topology.json) ConfigDir string // TopologyPath is the file path for the local topology JSON file. TopologyPath string `toml:"Topology"` // Topology is the loaded topology file. Topology *topology.Topo `toml:"-"` // ReconnectToDispatcher can be set to true to enable the snetproxy reconnecter. ReconnectToDispatcher bool }
type Infra ¶
type Infra struct { // Type must be one of BS, CS or PS. Type string }
Infra contains information that is BS, CS, PS specific.
type Logging ¶
type Logging struct { File struct { // Path is the location of the logging file. If unset, no file logging // is performed. Path string // Level of file logging (defaults to DefaultLoggingLevel). Level string // Size is the max size of log file in MiB (defaults to DefaultLoggingFileSize) Size uint // Max age of log file in days (defaults to DefaultLoggingFileMaxAge) MaxAge uint // FlushInterval specifies how frequently to flush to the log file, // in seconds FlushInterval int } Console struct { // Level of console logging. If unset, no console logging is // performed. Level string } }
type Metrics ¶
type Metrics struct { // Prometheus contains the address to export prometheus metrics on. If // not set, metrics are not exported. Prometheus string }
func (*Metrics) StartPrometheus ¶ added in v0.1.1
Click to show internal directories.
Click to hide internal directories.