config

package
v0.0.0-...-c5fcff7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: MIT Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchRemoteList

func FetchRemoteList(
	gl *Global,
	maxNumRemoteTargets int,
	maxNumSrcTCPPorts uint16,
	minBatchInterval time.Duration,
	HTTPResponseHeaderTimeout time.Duration,
	orchestratorRESTConf string,
	kill chan struct{},
	logger *log.Logger,
) error

FetchRemoteList fetches the configuration file from local path or, remotely, from Arachne Orchestrator.

func GetHostname

func GetHostname(logger *log.Logger) (string, error)

GetHostname returns the hostname.

func ResolveDNSTargets

func ResolveDNSTargets(
	remotes RemoteStore,
	grc *RemoteConfig,
	DNSRefresh *time.Ticker,
	wg *sync.WaitGroup,
	kill chan struct{},
	logger *log.Logger,
)

ResolveDNSTargets resolves the DNS names of the IP addresses of all echo targets and the localhost.

Types

type AppConfig

type AppConfig struct {
	Logging                *zap.Config
	Verbose                bool
	PIDPath                string
	Orchestrator           OrchestratorConfig
	StandaloneTargetConfig string
	Metrics                metrics.Config
}

AppConfig holds the info parsed from the local YAML config file.

func Get

func Get(cc *CLIConfig, ec *Extended, logger *log.Logger) (*AppConfig, error)

Get fetches the configuration file from local path.

type ArachneConfiguration

type ArachneConfiguration struct {
	PIDPath                string             `yaml:"pidPath"`
	Orchestrator           OrchestratorConfig `yaml:"orchestrator"`
	StandaloneTargetConfig string             `yaml:"standaloneTargetConfig"`
}

ArachneConfiguration contains specific configuration to Arachne.

type BasicConfig

type BasicConfig struct {
	Logging log.Config           `yaml:"logging"`
	Arachne ArachneConfiguration `yaml:"arachne"`
}

BasicConfig holds the basic parameter configurations for the application.

type CLIConfig

type CLIConfig struct {
	ConfigFile       *string
	Foreground       *bool
	ReceiverOnlyMode *bool
	SenderOnlyMode   *bool
}

CLIConfig holds the info parsed from CLI.

func ParseCliArgs

func ParseCliArgs(logger *log.Logger, service string, version string) *CLIConfig

ParseCliArgs provides the usage and help menu, and parses the actual arguments.

type Extended

type Extended struct {
	Metrics metrics.Opt
}

Extended holds the parameter configurations implemented by outside callers.

type Global

type Global struct {
	App          *AppConfig
	CLI          *CLIConfig
	RemoteConfig *RemoteConfig
	Remotes      RemoteStore
}

Global holds the global application info.

type OrchestratorConfig

type OrchestratorConfig struct {
	Enabled     bool   `yaml:"enabled"`
	AddrPort    string `yaml:"addrport"`
	RESTVersion string `yaml:"restVersion"`
}

OrchestratorConfig contains configuration for the Arachne Orchestrator.

type Remote

type Remote struct {
	IP       net.IP
	AF       string
	Hostname string
	Location string
	External bool
}

Remote holds the info for every target to be echoed.

type RemoteConfig

type RemoteConfig struct {
	Location                 string
	HostName                 string
	SrcAddress               net.IP
	SrcTCPPortRange          tcp.PortRange
	InterfaceName            string
	TargetTCPPort            layers.TCPPort
	Timeout                  time.Duration
	BatchInterval            time.Duration
	QoSEnabled               bool
	ResolveDNS               bool
	DNSServersAlt            []net.IP
	PollOrchestratorInterval pollInterval
}

RemoteConfig holds the info parsed from the JSON config file.

type RemoteFileConfig

type RemoteFileConfig struct {
	Local struct {
		Location                        string         `json:"location"`
		HostName                        string         `json:"host_name"`
		SrcAddress                      string         `json:"src_address"`
		InterfaceName                   string         `json:"interface_name"`
		TargetTCPPort                   layers.TCPPort `json:"target_tcp_port"`
		Timeout                         string         `json:"timeout"`
		BaseSrcTCPPort                  layers.TCPPort `json:"base_src_tcp_port"`
		NumSrcTCPPorts                  uint16         `json:"num_src_tcp_ports"`
		BatchInterval                   string         `json:"batch_interval"`
		QoSEnabled                      string         `json:"qos"`
		ResolveDNS                      string         `json:"resolve_dns"`
		DNSServersAlt                   string         `json:"dns_servers_alternate"`
		PollOrchestratorIntervalSuccess string         `json:"poll_orchestrator_interval_success"`
		PollOrchestratorIntervalFailure string         `json:"poll_orchestrator_interval_failure"`
	} `json:"local"`
	Internal []target `json:"internal"`
	External []target `json:"external"`
}

RemoteFileConfig needed for the JSON decoder to know which fields to expect and parse.

type RemoteStore

type RemoteStore map[string]Remote

RemoteStore holds all Remotes.

Jump to

Keyboard shortcuts

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