podopts

package
Version: v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Unlicense Imports: 23 Imported by: 0

Documentation

Overview

Package podopts is a configuration system to fit with the all-in-one philosophy guiding the design of the parallelcoin pod.

The configuration is stored by each component of the connected applications, so all data is stored in concurrent-safe atomics, and there is a facility to invoke a function in response to a new value written into a field by other threads.

There is a custom JSON marshal/unmarshal for each field type and for the whole configuration that only saves values that differ from the defaults, similar to 'omitempty' in struct tags but where 'empty' is the default value instead of the default zero created by Go's memory allocator. This enables easy compositing of multiple sources.

Index

Constants

This section is empty.

Variables

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)

Functions

This section is empty.

Types

type Config

type Config struct {
	// ShowAll is a flag to make the json encoder explicitly define all fields and not just the ones different to the
	// defaults
	ShowAll bool
	// Map is the same data but addressible using its name as found inside the various configuration types, the key is
	// converted to lower case for CLI args
	Map                    map[string]opt.Option
	Commands               cmds.Commands
	RunningCommand         cmds.Command
	ExtraArgs              []string
	AddCheckpoints         *list.Opt
	AddPeers               *list.Opt
	AddrIndex              *binary.Opt
	AutoListen             *binary.Opt
	AutoPorts              *binary.Opt
	BanDuration            *duration.Opt
	BanThreshold           *integer.Opt
	BlockMaxSize           *integer.Opt
	BlockMaxWeight         *integer.Opt
	BlockMinSize           *integer.Opt
	BlockMinWeight         *integer.Opt
	BlockPrioritySize      *integer.Opt
	BlocksOnly             *binary.Opt
	CAFile                 *text.Opt
	CPUProfile             *text.Opt
	ClientTLS              *binary.Opt
	ConfigFile             *text.Opt
	ConnectPeers           *list.Opt
	Controller             *binary.Opt
	DarkTheme              *binary.Opt
	DataDir                *text.Opt
	DbType                 *text.Opt
	DisableBanning         *binary.Opt
	DisableCheckpoints     *binary.Opt
	DisableDNSSeed         *binary.Opt
	DisableListen          *binary.Opt
	DisableRPC             *binary.Opt
	Discovery              *binary.Opt
	ExternalIPs            *list.Opt
	FreeTxRelayLimit       *float.Opt
	GenThreads             *integer.Opt
	Generate               *binary.Opt
	Hilite                 *list.Opt
	LAN                    *binary.Opt
	LimitPass              *text.Opt
	LimitUser              *text.Opt
	Locale                 *text.Opt
	LogDir                 *text.Opt
	LogFilter              *list.Opt
	LogLevel               *text.Opt
	MaxOrphanTxs           *integer.Opt
	MaxPeers               *integer.Opt
	MinRelayTxFee          *float.Opt
	MulticastPass          *text.Opt
	Network                *text.Opt
	NoCFilters             *binary.Opt
	NoInitialLoad          *binary.Opt
	NoPeerBloomFilters     *binary.Opt
	NoRelayPriority        *binary.Opt
	NodeOff                *binary.Opt
	OneTimeTLSKey          *binary.Opt
	OnionEnabled           *binary.Opt
	OnionProxyAddress      *text.Opt
	OnionProxyPass         *text.Opt
	OnionProxyUser         *text.Opt
	P2PConnect             *list.Opt
	P2PListeners           *list.Opt
	Password               *text.Opt
	PipeLog                *binary.Opt
	Profile                *text.Opt
	ProxyAddress           *text.Opt
	ProxyPass              *text.Opt
	ProxyUser              *text.Opt
	RPCCert                *text.Opt
	RPCConnect             *text.Opt
	RPCKey                 *text.Opt
	RPCListeners           *list.Opt
	RPCMaxClients          *integer.Opt
	RPCMaxConcurrentReqs   *integer.Opt
	RPCMaxWebsockets       *integer.Opt
	RPCQuirks              *binary.Opt
	RejectNonStd           *binary.Opt
	RelayNonStd            *binary.Opt
	RunAsService           *binary.Opt
	Save                   *binary.Opt
	ServerTLS              *binary.Opt
	SigCacheMaxSize        *integer.Opt
	Solo                   *binary.Opt
	TLSSkipVerify          *binary.Opt
	TorIsolation           *binary.Opt
	TrickleInterval        *duration.Opt
	TxIndex                *binary.Opt
	UPNP                   *binary.Opt
	UUID                   *integer.Opt
	UseWallet              *binary.Opt
	UserAgentComments      *list.Opt
	Username               *text.Opt
	WalletFile             *text.Opt
	WalletOff              *binary.Opt
	WalletPass             *text.Opt
	WalletRPCListeners     *list.Opt
	WalletRPCMaxClients    *integer.Opt
	WalletRPCMaxWebsockets *integer.Opt
	WalletServer           *text.Opt
	Whitelists             *list.Opt
}

Config defines the configuration items used by pod along with the various components included in the suite

func (*Config) ForEach

func (c *Config) ForEach(fn func(ifc opt.Option) bool) bool

ForEach iterates the options in defined order with a closure that takes an opt.Option

func (*Config) GetOption

func (c *Config) GetOption(input string) (op opt.Option, value string, e error)

GetOption searches for a match amongst the podopts

func (*Config) Initialize

func (c *Config) Initialize() (e error)

Initialize loads in configuration from disk and from environment on top of the default base

func (*Config) MarshalJSON

func (c *Config) MarshalJSON() (b []byte, e error)

MarshalJSON implements the json marshaller for the config. It only stores non-default values so can be composited.

func (*Config) ReadCAFile

func (c *Config) ReadCAFile() []byte

ReadCAFile reads in the configured Certificate Authority for TLS connections

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) (e error)

UnmarshalJSON implements the Unmarshaller interface so it only writes to fields with those non-default values set.

func (*Config) WriteToFile

func (c *Config) WriteToFile(filename string) (e error)

WriteToFile writes the current config to a file as json

type ConfigSlice

type ConfigSlice []ConfigSliceElement

func (ConfigSlice) Len

func (c ConfigSlice) Len() int

func (ConfigSlice) Less

func (c ConfigSlice) Less(i, j int) bool

func (ConfigSlice) Swap

func (c ConfigSlice) Swap(i, j int)

type ConfigSliceElement

type ConfigSliceElement struct {
	Opt  opt.Option
	Name string
}

type Configs

type Configs map[string]opt.Option

Configs is the source location for the Config items, which is used to generate the Config struct

Directories

Path Synopsis
This generator reads a podcfg.Configs map and spits out a podcfg.Config struct
This generator reads a podcfg.Configs map and spits out a podcfg.Config struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL