Documentation ¶
Overview ¶
Package env contains common command line and initialization code for SCION Infrastructure 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.
TODO(scrye): Also common stuff like trustdb initialization, messenger initialization and handler registration can go here. Everything that can be shared by infra apps, to reduce duplicated code.
Index ¶
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 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:"-"` // Seed for the PRNG. A value of 0 means use current UNIX time as seed. Seed int64 }
type Infra ¶
type Infra struct { // Type must be one of BS, CS or PS. Type string // Public is the local address to listen on for SCION messages (if Bind is // not set), and to send out messages to other nodes. Public snet.Addr // If set, Bind is the preferred local address to listen on for SCION // messages. Bind snet.Addr }
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 } }
Click to show internal directories.
Click to hide internal directories.