config

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path     string `json:"-"`
	LogLevel string `json:"logLevel" envconfig:"LOG_LEVEL"`
	Peer     struct {
		PrivateKey           crypto.PrivateKey `json:"privateKey" envconfig:"PRIVATE_KEY"`
		BindAddress          string            `json:"bindAddress" envconfig:"BIND_ADDRESS"`
		Bootstraps           []peer.Shorthand  `json:"bootstraps" envconfig:"BOOTSTRAPS"`
		ListenOnLocalIPs     bool              `json:"listenLocalIPs" envconfig:"LISTEN_LOCAL"`
		ListenOnPrivateIPs   bool              `json:"listenPrivateIPs" envconfig:"LISTEN_PRIVATE"`
		ListenOnExternalPort bool              `json:"listenExternalPort" envconfig:"LISTEN_EXTERNAL_PORT"`
	} `json:"peer" envconfig:"PEER"`
	Extras map[string]json.RawMessage `json:"extras,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Config, error)

type Option

type Option func(*Config)

func WithDefaultBootstraps

func WithDefaultBootstraps(peers []peer.Shorthand) Option

func WithDefaultDefaultPeerBindAddress

func WithDefaultDefaultPeerBindAddress(address string) Option

func WithDefaultFilename

func WithDefaultFilename(filename string) Option

func WithDefaultListenOnExternalPort

func WithDefaultListenOnExternalPort() Option

func WithDefaultListenOnLocalIPs

func WithDefaultListenOnLocalIPs() Option

func WithDefaultListenOnPrivateIPs

func WithDefaultListenOnPrivateIPs() Option

func WithDefaultPath

func WithDefaultPath(path string) Option

func WithDefaultPrivateKey

func WithDefaultPrivateKey(key crypto.PrivateKey) Option

func WithExtraConfig

func WithExtraConfig(key string, data interface{}) Option

Jump to

Keyboard shortcuts

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