config

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIP = "0.0.0.0"
)

Variables

View Source
var (
	Conf = &Config{}

	HomeDir = &cli.StringFlag{
		Name:        "appdata",
		Aliases:     []string{"A"},
		Usage:       "Path to application home directory",
		Value:       defaultHomeDir,
		Destination: &Conf.HomeDir,
	}
	DataDir = &cli.StringFlag{
		Name:        "datadir",
		Aliases:     []string{"b"},
		Usage:       "Directory to store data",
		Value:       defaultDataDir,
		Destination: &Conf.DataDir,
	}

	PrivateKey = &cli.StringFlag{
		Name:        "privatekey",
		Aliases:     []string{"p"},
		Usage:       "private key",
		Destination: &Conf.PrivateKey,
	}

	ExternalIP = &cli.StringFlag{
		Name:        "externalip",
		Aliases:     []string{"i"},
		Usage:       "listen external ip",
		Destination: &Conf.ExternalIP,
	}

	Port = &cli.StringFlag{
		Name:        "port",
		Aliases:     []string{"o"},
		Usage:       "listen port",
		Value:       defaultPort,
		Destination: &Conf.Port,
	}

	EnableNoise = &cli.BoolFlag{
		Name:        "noise",
		Aliases:     []string{"n"},
		Usage:       "noise",
		Value:       false,
		Destination: &Conf.EnableNoise,
	}

	Network = &cli.StringFlag{
		Name:        "network",
		Aliases:     []string{"e"},
		Usage:       "Network {mainnet,mixnet,privnet,testnet}",
		Value:       params.MixNetParam.Name,
		Destination: &Conf.Network,
	}

	HostDNS = &cli.StringFlag{
		Name:        "externaldns",
		Aliases:     []string{"s"},
		Usage:       "The DNS address advertised by libp2p. This may be used to advertise an external DNS.",
		Value:       "",
		Destination: &Conf.HostDNS,
	}

	UsePeerStore = &cli.BoolFlag{
		Name:        "pstore",
		Aliases:     []string{"r"},
		Usage:       "P2P Peer store",
		Value:       true,
		Destination: &Conf.UsePeerStore,
	}

	NoFileLogging = &cli.BoolFlag{
		Name:        "nofilelogging",
		Aliases:     []string{"l"},
		Usage:       "Disable file logging.",
		Value:       false,
		Destination: &Conf.NoFileLogging,
	}

	LogRotatorSize = &cli.Int64Flag{
		Name:        "logrotatorsize",
		Aliases:     []string{"lrs"},
		Usage:       "log rotator size.",
		Value:       10 * 1024,
		Destination: &Conf.LogRotatorSize,
	}

	DebugLevel = &cli.StringFlag{
		Name:        "debuglevel",
		Aliases:     []string{"dl"},
		Usage:       "Logging level {trace, debug, info, warn, error, critical} ",
		Value:       "info",
		Destination: &Conf.DebugLevel,
	}

	DisableRPC = &cli.BoolFlag{
		Name:        "norpc",
		Aliases:     []string{"nr"},
		Usage:       "Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass",
		Value:       true,
		Destination: &Conf.DisableRPC,
	}

	DebugPrintOrigins = &cli.BoolFlag{
		Name:        "printorigin",
		Usage:       "Print log debug location (file:line)",
		Value:       false,
		Destination: &Conf.DebugPrintOrigins,
	}

	RPCListeners = &cli.StringSliceFlag{
		Name:        "rpclisten",
		Aliases:     []string{"rl"},
		Usage:       "Add an interface/port to listen for RPC connections",
		Destination: &Conf.RPCListeners,
	}

	RPCUser = &cli.StringFlag{
		Name:        "rpcuser",
		Aliases:     []string{"ru"},
		Usage:       "Username for RPC connections",
		Value:       "test",
		Destination: &Conf.RPCUser,
	}

	RPCPass = &cli.StringFlag{
		Name:        "rpcpass",
		Aliases:     []string{"rp"},
		Usage:       "Password for RPC connections",
		Value:       "test",
		Destination: &Conf.RPCPass,
	}

	RPCCert = &cli.StringFlag{
		Name:        "rpccert",
		Aliases:     []string{"rc"},
		Usage:       "File containing the certificate file",
		Value:       defaultRPCCertPath,
		Destination: &Conf.RPCCert,
	}

	RPCKey = &cli.StringFlag{
		Name:        "rpckey",
		Aliases:     []string{"rk"},
		Usage:       "File containing the certificate key",
		Value:       defaultRPCKeyPath,
		Destination: &Conf.RPCKey,
	}

	RPCMaxClients = &cli.IntFlag{
		Name:        "rpcmaxclients",
		Aliases:     []string{"rmc"},
		Usage:       "Max number of RPC clients for standard connections",
		Value:       defaultMaxRPCClients,
		Destination: &Conf.RPCMaxClients,
	}

	DisableTLS = &cli.BoolFlag{
		Name:        "notls",
		Aliases:     []string{"nt"},
		Usage:       "Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost",
		Value:       false,
		Destination: &Conf.DisableTLS,
	}

	EnableRelay = &cli.BoolFlag{
		Name:        "relay",
		Aliases:     []string{"re"},
		Usage:       "Enable relay service for node",
		Value:       false,
		Destination: &Conf.EnableRelay,
	}

	MaxPeers = &cli.IntFlag{
		Name:        "maxpeers",
		Aliases:     []string{"mp"},
		Usage:       "Max number of inbound and outbound peers",
		Value:       defaultMaxPeers,
		Destination: &Conf.MaxPeers,
	}

	EnableAmana = &cli.BoolFlag{
		Name:        "amana",
		Aliases:     []string{"am"},
		Usage:       "Enable Amana support",
		Value:       false,
		Destination: &Conf.AmanaBoot.Enable,
	}

	AmanaListenAddr = &cli.StringFlag{
		Name:        "addr",
		Aliases:     []string{"qa"},
		Usage:       "Amana listen address",
		Value:       defaultAmanaListenAddr,
		Destination: &Conf.AmanaBoot.ListenAddr,
	}

	AmanaNAT = &cli.StringFlag{
		Name:        "nat",
		Aliases:     []string{"na"},
		Usage:       "Amana port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
		Value:       "none",
		Destination: &Conf.AmanaBoot.Natdesc,
	}

	AmanaNetrestrict = &cli.StringFlag{
		Name:        "netrestrict",
		Aliases:     []string{"ne"},
		Usage:       "Amana restrict network communication to the given IP networks (CIDR masks)",
		Value:       "",
		Destination: &Conf.AmanaBoot.Netrestrict,
	}

	AmanaRunv5 = &cli.BoolFlag{
		Name:        "v5",
		Usage:       "run a v5 topic discovery Amana",
		Value:       false,
		Destination: &Conf.AmanaBoot.Runv5,
	}

	AppFlags = []cli.Flag{
		HomeDir,
		DataDir,
		PrivateKey,
		ExternalIP,
		Port,
		EnableNoise,
		Network,
		HostDNS,
		UsePeerStore,
		NoFileLogging,
		LogRotatorSize,
		DebugLevel,
		DebugPrintOrigins,
		DisableRPC,
		RPCListeners,
		RPCUser,
		RPCPass,
		RPCCert,
		RPCKey,
		RPCMaxClients,
		DisableTLS,
		EnableRelay,
		MaxPeers,
		EnableAmana,
		AmanaListenAddr,
		AmanaNAT,
		AmanaNetrestrict,
		AmanaRunv5,
	}
)

Functions

This section is empty.

Types

type AmanaBootConfig added in v1.0.20

type AmanaBootConfig struct {
	Enable      bool
	ListenAddr  string
	Natdesc     string
	Netrestrict string
	Runv5       bool
}

type Config

type Config struct {
	HomeDir           string
	DataDir           string
	PrivateKey        string
	ExternalIP        string
	Port              string
	EnableNoise       bool
	Network           string
	HostDNS           string
	UsePeerStore      bool
	NoFileLogging     bool
	LogRotatorSize    int64
	DebugLevel        string
	DebugPrintOrigins bool

	DisableRPC    bool
	RPCListeners  cli.StringSlice
	RPCUser       string
	RPCPass       string
	RPCCert       string
	RPCKey        string
	RPCMaxClients int
	DisableTLS    bool
	EnableRelay   bool
	MaxPeers      int

	AmanaBoot AmanaBootConfig
}

func (*Config) Load

func (c *Config) Load() error

Jump to

Keyboard shortcuts

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