global

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package global provides types and methods to parse global options for PIP CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Input holds path to file with requests.
	Input string
	// N is a number of requests to send.
	N int

	// Network stores kind of destination network.
	Network string
	// Address represents destination address.
	Address string

	// Servers is an array of servers used to initialize balancer.
	Servers StringSet
	// RoundRobinBalancer turns on round-robin balancer.
	RoundRobinBalancer bool
	// HotSpotBalancer turns on hot-spot balancer.
	HotSpotBalancer bool

	// DNSRadar turns on discovery by default DNS resolver.
	DNSRadar bool
	// K8sRadar turns on discovery by in-cluster kubernetes tools.
	K8sRadar bool

	// MaxRequestSize limits request size in bytes.
	MaxRequestSize int
	// MaxQueue limits number of requests client can send in parallel.
	MaxQueue int
	// BufferSize defines size of input and output buffers.
	BufferSize int
	// ConnTimeout sets connection timeout.
	ConnTimeout time.Duration
	// WriteInterval is duration after which data from write buffer are sent to
	// network even if write buffer isn't full.
	WriteInterval time.Duration
	// ResponseTimeout sets response timeout.
	ResponseTimeout time.Duration
	// ResponseCheckInterval is an inteval of response timeout checks.
	ResponseCheckInterval time.Duration
	// Requests holds a list of information requests.
	Requests []Request
	// Client is PIP client interface.
	Client client.Client
}

Config holds all global options for PIP CLI.

func NewConfigFromCommandLine

func NewConfigFromCommandLine(usage func()) *Config

NewConfigFromCommandLine parses command line arguments and fills Config accordingly.

func (*Config) LoadRequests

func (conf *Config) LoadRequests() (err error)

LoadRequests get a list of requests from YAML file.

func (*Config) NewClient

func (conf *Config) NewClient(f client.ConnErrHandler) client.Client

NewClient creates PIP client according global options.

type Request

type Request struct {
	// Path identifies information endpoint within single PIP instance.
	Path string
	// Args is a list of arguments.
	Args []pdp.AttributeValue
}

Request represent single information request to PIP.

type StringSet

type StringSet []string

StringSet implements flag.Value inteface to accept array of strings as command line argument.

func (*StringSet) Set

func (s *StringSet) Set(v string) error

Set appends given value to the end of array.

func (*StringSet) String

func (s *StringSet) String() string

String returns human readable representation of the array.

Jump to

Keyboard shortcuts

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