cfgutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(filePath string) (bool, error)

FileExists reports whether the named file or directory exists.

func NormalizeAddress

func NormalizeAddress(addr string, defaultPort string) (hostport string, err error)

NormalizeAddress returns the normalized form of the address, adding a default port if necessary. An error is returned if the address, even without a port, is not valid.

func NormalizeAddresses

func NormalizeAddresses(addrs []string, defaultPort string) ([]string, error)

NormalizeAddresses returns a new slice with all the passed peer addresses normalized with the given default port, and all duplicates removed.

Types

type AddressFlag added in v1.0.8

type AddressFlag struct {
	dcrutil.Address
}

AddressFlag embeds a dcrutil.Address and implements the flags.Marshaler and Unmarshaler interfaces so it can be used as a config struct field.

func NewAddressFlag added in v1.0.8

func NewAddressFlag(defaultValue dcrutil.Address) *AddressFlag

NewAddressFlag creates an AddressFlag with a default dcrutil.Address.

func (*AddressFlag) MarshalFlag added in v1.0.8

func (a *AddressFlag) MarshalFlag() (string, error)

MarshalFlag satisifes the flags.Marshaler interface.

func (*AddressFlag) UnmarshalFlag added in v1.0.8

func (a *AddressFlag) UnmarshalFlag(addr string) error

UnmarshalFlag satisifes the flags.Unmarshaler interface.

type AmountFlag added in v0.1.0

type AmountFlag struct {
	dcrutil.Amount
}

AmountFlag embeds a dcrutil.Amount and implements the flags.Marshaler and Unmarshaler interfaces so it can be used as a config struct field.

func NewAmountFlag added in v0.1.3

func NewAmountFlag(defaultValue dcrutil.Amount) *AmountFlag

NewAmountFlag creates an AmountFlag with a default dcrutil.Amount.

func (*AmountFlag) MarshalFlag added in v0.1.0

func (a *AmountFlag) MarshalFlag() (string, error)

MarshalFlag satisifes the flags.Marshaler interface.

func (*AmountFlag) UnmarshalFlag added in v0.1.0

func (a *AmountFlag) UnmarshalFlag(value string) error

UnmarshalFlag satisifes the flags.Unmarshaler interface.

type CurveFlag added in v0.7.0

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

CurveFlag describes a curve and implements the flags.Marshaler and Unmarshaler interfaces so it can be used as a config struct field.

func NewCurveFlag added in v0.7.0

func NewCurveFlag(defaultValue CurveID) *CurveFlag

NewCurveFlag creates a CurveFlag with a default curve.

func (*CurveFlag) Curve added in v0.7.0

func (f *CurveFlag) Curve() elliptic.Curve

Curve returns the elliptic.Curve specified by the flag.

func (*CurveFlag) MarshalFlag added in v0.7.0

func (f *CurveFlag) MarshalFlag() (name string, err error)

MarshalFlag satisifes the flags.Marshaler interface.

func (*CurveFlag) UnmarshalFlag added in v0.7.0

func (f *CurveFlag) UnmarshalFlag(value string) error

UnmarshalFlag satisifes the flags.Unmarshaler interface.

type CurveID added in v0.7.0

type CurveID int

CurveID specifies a recognized curve through a constant value.

const (
	CurveP224 CurveID = iota
	CurveP256
	CurveP384
	CurveP521
)

Recognized curve IDs.

type ExplicitString added in v1.0.7

type ExplicitString struct {
	Value string
	// contains filtered or unexported fields
}

ExplicitString is a string value implementing the flags.Marshaler and flags.Unmarshaler interfaces so it may be used as a config struct field. It records whether the value was explicitly set by the flags package. This is useful when behavior must be modified depending on whether a flag was set by the user or left as a default. Without recording this, it would be impossible to determine whether flag with a default value was unmodified or explicitly set to the default.

func NewExplicitString added in v1.0.7

func NewExplicitString(defaultValue string) *ExplicitString

NewExplicitString creates a string flag with the provided default value.

func (*ExplicitString) ExplicitlySet added in v1.0.7

func (e *ExplicitString) ExplicitlySet() bool

ExplicitlySet returns whether the flag was explicitly set through the flags.Unmarshaler interface.

func (*ExplicitString) MarshalFlag added in v1.0.7

func (e *ExplicitString) MarshalFlag() (string, error)

MarshalFlag implements the flags.Marshaler interface.

func (*ExplicitString) String added in v1.0.7

func (e *ExplicitString) String() string

String implements the fmt.Stringer interface.

func (*ExplicitString) UnmarshalFlag added in v1.0.7

func (e *ExplicitString) UnmarshalFlag(value string) error

UnmarshalFlag implements the flags.Unmarshaler interface.

Jump to

Keyboard shortcuts

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