common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Operating environment.
	OptEnvironment      = "environment"
	OptEnvironmentAlias = "e"
	OptEnvironmentAzure = "azure"
	OptEnvironmentMAS   = "mas"

	// Logging level.
	OptLogLevel      = "log-level"
	OptLogLevelAlias = "l"
	OptLogLevelInfo  = "info"
	OptLogLevelDebug = "debug"

	// Logging target.
	OptLogTarget       = "log-target"
	OptLogTargetAlias  = "t"
	OptLogTargetSyslog = "syslog"
	OptLogTargetStderr = "stderr"
	OptLogTargetFile   = "logfile"

	// IPAM query URL.
	OptIpamQueryUrl      = "ipam-query-url"
	OptIpamQueryUrlAlias = "u"

	// IPAM query interval.
	OptIpamQueryInterval      = "ipam-query-interval"
	OptIpamQueryIntervalAlias = "i"

	// Version.
	OptVersion      = "version"
	OptVersionAlias = "v"

	// Help.
	OptHelp      = "help"
	OptHelpAlias = "h"
)

Command line options.

Variables

This section is empty.

Functions

func GetAddressAsCidr added in v0.3.0

func GetAddressAsCidr(ip string, prefix uint8) string

func GetArg

func GetArg(name string) interface{}

GetArg returns the parsed value of the given argument.

func LogNetworkInterfaces

func LogNetworkInterfaces()

LogNetworkInterfaces logs the host's network interfaces in the default namespace.

func ParseArgs

func ParseArgs(args *ArgumentList, usage func())

ParseArgs parses and validates command line arguments based on rules in the given ArgumentList.

Types

type Argument

type Argument struct {
	Name         string
	Shorthand    string
	Description  string
	Type         string
	DefaultValue interface{}
	Value        interface{}
	ValueMap     map[string]interface{}
	// contains filtered or unexported fields
}

Argument represents a command line argument.

type ArgumentList

type ArgumentList []*Argument

ArgumentList represents a set of command line arguments.

type IpamApi

type IpamApi interface {
}

IPAM internal interface.

type NetAPI

type NetAPI interface {
}

Network internal interface.

type Plugin

type Plugin struct {
	Name    string
	Version string
	Options map[string]interface{}
	ErrChan chan error
}

Plugin is the parent class that implements behavior common to all plugins.

func NewPlugin

func NewPlugin(name, version string) (*Plugin, error)

NewPlugin creates a new Plugin object.

func (*Plugin) GetOption

func (plugin *Plugin) GetOption(key string) interface{}

GetOption gets the option value for the given key.

func (*Plugin) Initialize

func (plugin *Plugin) Initialize(config *PluginConfig) error

Initialize initializes the plugin.

func (*Plugin) SetOption

func (plugin *Plugin) SetOption(key string, value interface{})

SetOption sets the option value for the given key.

func (*Plugin) Uninitialize

func (plugin *Plugin) Uninitialize()

Uninitialize cleans up the plugin.

type PluginApi

type PluginApi interface {
	Start(*PluginConfig) error
	Stop()
	GetOption(string) interface{}
	SetOption(string, interface{})
}

Plugin base interface.

type PluginConfig

type PluginConfig struct {
	Name    string
	Version string
	NetApi  NetAPI
}

Plugin common configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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