util

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyPairCreated is returned by LoadRPCKeyPair if a new keypair has just
	// been created
	ErrKeyPairCreated = errors.New("created rpc keypair")
)

Functions

func CleanAndExpandPath

func CleanAndExpandPath(path string) string

CleanAndExpandPath expands environement variables and leading ~ in the passed path, cleans the result, and returns it.

func GenerateRPCKeyPair

func GenerateRPCKeyPair(keyFile, certFile string) error

GenerateRPCKeyPair generates a keypair for use with grpc

func LoadRPCKeyPair

func LoadRPCKeyPair(keyFile, certFile string) (*tls.Certificate, error)

LoadRPCKeyPair loads or creates the given keypair if it does not exist

func LogFileName added in v0.5.2

func LogFileName(dir string, baseName string) string

LogFileName returns a new non-existant log filename that can be used as a new log file in the given dir.

func StandardLogBackend

func StandardLogBackend(toStdErr bool, dir string, baseName string) *slog.Backend

StandardLogBackend returns a standard backend that can output to stderr and to a file

Types

type MasterPubPoolAddrValidator

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

MasterPubPoolAddrValidator validates addresses given a masterpubkey

func NewMasterPubPoolAddrValidator

func NewMasterPubPoolAddrValidator(masterPubKey string, net *chaincfg.Params) (
	*MasterPubPoolAddrValidator, error)

NewMasterPubPoolAddrValidator creates a new validator given an extended master pubkey for an account.

func (*MasterPubPoolAddrValidator) ValidateByEncodedAddr

func (v *MasterPubPoolAddrValidator) ValidateByEncodedAddr(addr string) error

ValidateByEncodedAddr validate directly by a string value. Assumes addr is the result of a call to EncodeAddress()

func (*MasterPubPoolAddrValidator) ValidatePoolSubsidyAddress

func (v *MasterPubPoolAddrValidator) ValidatePoolSubsidyAddress(poolAddr dcrutil.Address) error

ValidatePoolSubsidyAddress fulfills matcher.PoolAddressValidationProvider

type PrefixLogger added in v0.7.0

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

PrefixLogger logs messages prefixed with a given string prefix

func NewPrefixLogger added in v0.7.0

func NewPrefixLogger(prefix string, parent slog.Logger) *PrefixLogger

NewPrefixLogger returns a new PrefixLogger configured to use the given prefix and send log messages to the specified parent

func (*PrefixLogger) Critical added in v0.7.0

func (pl *PrefixLogger) Critical(v ...interface{})

Critical fulfills the slog.Logger interface

func (*PrefixLogger) Criticalf added in v0.7.0

func (pl *PrefixLogger) Criticalf(format string, params ...interface{})

Criticalf fulfills the slog.Logger interface

func (*PrefixLogger) Debug added in v0.7.0

func (pl *PrefixLogger) Debug(v ...interface{})

Debug fulfills the slog.Logger interface

func (*PrefixLogger) Debugf added in v0.7.0

func (pl *PrefixLogger) Debugf(format string, params ...interface{})

Debugf fulfills the slog.Logger interface

func (*PrefixLogger) Error added in v0.7.0

func (pl *PrefixLogger) Error(v ...interface{})

Error fulfills the slog.Logger interface

func (*PrefixLogger) Errorf added in v0.7.0

func (pl *PrefixLogger) Errorf(format string, params ...interface{})

Errorf fulfills the slog.Logger interface

func (*PrefixLogger) Info added in v0.7.0

func (pl *PrefixLogger) Info(v ...interface{})

Info fulfills the slog.Logger interface

func (*PrefixLogger) Infof added in v0.7.0

func (pl *PrefixLogger) Infof(format string, params ...interface{})

Infof fulfills the slog.Logger interface

func (*PrefixLogger) Level added in v0.7.0

func (pl *PrefixLogger) Level() slog.Level

Level fulfills the slog.Logger interface

func (*PrefixLogger) SetLevel added in v0.7.0

func (pl *PrefixLogger) SetLevel(level slog.Level)

SetLevel fulfills the slog.Logger interface

func (*PrefixLogger) Trace added in v0.7.0

func (pl *PrefixLogger) Trace(v ...interface{})

Trace fulfills the slog.Logger interface

func (*PrefixLogger) Tracef added in v0.7.0

func (pl *PrefixLogger) Tracef(format string, params ...interface{})

Tracef fulfills the slog.Logger interface

func (*PrefixLogger) Warn added in v0.7.0

func (pl *PrefixLogger) Warn(v ...interface{})

Warn fulfills the slog.Logger interface

func (*PrefixLogger) Warnf added in v0.7.0

func (pl *PrefixLogger) Warnf(format string, params ...interface{})

Warnf fulfills the slog.Logger interface

type TCPKeepAliveListener added in v0.6.0

type TCPKeepAliveListener struct {
	*net.TCPListener
}

TCPKeepAliveListener is a listener that sets keepalive options on a connection after being accepted.

func (TCPKeepAliveListener) Accept added in v0.6.0

func (ln TCPKeepAliveListener) Accept() (net.Conn, error)

Accept fulfills the listener interface

Jump to

Keyboard shortcuts

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