flag

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SCIONEnvironment

type SCIONEnvironment struct {
	// contains filtered or unexported fields
}

SCIONEnvironment can be used to access the common SCION configuration values, like the SCION daemon address, the dispatcher socket address and the local IP as well as the local ISD-AS.

func (*SCIONEnvironment) Daemon

func (e *SCIONEnvironment) Daemon() string

Daemon returns the path to the SCION daemon. The value is loaded from one of the following sources with the precedence as listed:

  1. Command line flag
  2. Environment variable
  3. Environment configuration file
  4. Default value.

func (*SCIONEnvironment) Dispatcher

func (e *SCIONEnvironment) Dispatcher() string

Dispatcher returns the path to the SCION dispatcher socket. The value is loaded from one of the following sources with the precedence as listed:

  1. Command line flag
  2. Environment variable
  3. Environment configuration file
  4. Default value.

func (*SCIONEnvironment) LoadExternalVars

func (e *SCIONEnvironment) LoadExternalVars() error

LoadExternalVar loads variables from the SCION environment file and from the OS environment variables. Parsing errors will be reported with an error. A missing file or environment variable is not reported.

func (*SCIONEnvironment) Local

func (e *SCIONEnvironment) Local() netaddr.IP

Local returns the loca IP to listen on. The value is loaded from one of the following sources with the precedence as listed:

  1. Command line flag
  2. Environment variable
  3. Default value.

func (*SCIONEnvironment) Register

func (e *SCIONEnvironment) Register(flagSet *pflag.FlagSet)

Register registers the command line flags. This should be called when command line flags are set up, before any command that accesses the values is called. It is safe to not call this at all, which means command line flag values are not considered.

type TCPAddr

type TCPAddr net.TCPAddr

TCPAddr implements pflags.Value.

func (*TCPAddr) MarshalText

func (addr *TCPAddr) MarshalText() ([]byte, error)

func (*TCPAddr) Set

func (addr *TCPAddr) Set(input string) error

func (*TCPAddr) String

func (addr *TCPAddr) String() string

func (*TCPAddr) Type

func (addr *TCPAddr) Type() string

func (*TCPAddr) UnmarshalText

func (addr *TCPAddr) UnmarshalText(b []byte) error

type Time

type Time struct {
	// Time indicates the time after the flag is parsed.
	Time time.Time
	// Current indicates the current time for relative time duration.
	Current time.Time
	// Default is a custom default string.
	Default string
}

Time implements pflags.Value.

The flag value can be one of the following: - RFC3339 timestamp - unix timestamp - relative time duration

For relative time duration, the same formats as util.ParseDuration are supported.

The default value returned by the String() method is calculated as Time.Sub(Current), unless Default is set. If Default is set, that is returned as the default value.

Either Time or Default must be set. If neither is set, this flag panics when constructing the default value.

func (*Time) MarshalText

func (t *Time) MarshalText() ([]byte, error)

func (*Time) Set

func (t *Time) Set(input string) error

func (*Time) String

func (t *Time) String() string

func (*Time) Type

func (t *Time) Type() string

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(b []byte) error

type UDPAddr

type UDPAddr net.UDPAddr

UDPAddr implements pflags.Value.

func (*UDPAddr) MarshalText

func (addr *UDPAddr) MarshalText() ([]byte, error)

func (*UDPAddr) Set

func (addr *UDPAddr) Set(input string) error

func (*UDPAddr) String

func (addr *UDPAddr) String() string

func (*UDPAddr) Type

func (addr *UDPAddr) Type() string

func (*UDPAddr) UnmarshalText

func (addr *UDPAddr) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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