config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelInfo  = "info"
	LogLevelWarn  = "warn"
	LogLevelError = "error"
	LogLevelDebug = "debug"

	NodeModeDNS       = "dns"
	NodeModeSeed      = "seed"
	NodeModeSuperNode = "supernode"
	NodeModeNode      = "node"

	DefaultNodeAddress = "0.0.0.0"
	DefaultNodePort    = 45050
	DefaultNodeMode    = NodeModeNode
	DefaultNodeKey     = "Will be changed upon first run"
	DefaultAPIAddress  = "127.0.0.1"
	DefaultAPIPort     = 45505
	DefaultDNSAddress  = "127.0.0.1"
	DefaultDNSPort     = 8080
)

Variables

Functions

func WriteConfig added in v0.0.3

func WriteConfig(file string, config *Config) error

Types

type APIConfig

type APIConfig struct {
	Address string `mapstructure:"address"`
	Port    int    `mapstructure:"port"`
}

func DefaultAPIConfig

func DefaultAPIConfig() *APIConfig

type BaseConfig

type BaseConfig struct {
	// The root directory for all data.
	// This should be set in viper so it can unmarshal into this struct
	ConfigDir string `mapstructure:"config_folder"`
	//log level to set
	LogLevel string `mapstructure:"log_level"`
	// log file name
	LogFolder string `mapstructure:"log_folder"`
	// log file name
	LogFile string `mapstructure:"log_file"`
	// LevelDB path
	DatabasePath string `mapstructure:"database_path"`
}

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig Default configurable base parameters.

type Config

type Config struct {
	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`
	API        *APIConfig  `mapstructure:"api"`
	Node       *NodeConfig `mapstructure:"node"`
	DNS        *DNSConfig  `mapstructure:"dns"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig Default configurable parameters.

func (*Config) GetConfigFile

func (c *Config) GetConfigFile() string

func (*Config) GetConfigFolder

func (c *Config) GetConfigFolder() string

func (*Config) GetDatabaseFolder

func (c *Config) GetDatabaseFolder() string

func (*Config) GetLogFile

func (c *Config) GetLogFile() string

func (*Config) GetLogsFolder

func (c *Config) GetLogsFolder() string

type DNSConfig added in v0.0.3

type DNSConfig struct {
	Address string `mapstructure:"address"`
	Port    int    `mapstructure:"port"`
}

func DefaultDNSConfig added in v0.0.3

func DefaultDNSConfig() *DNSConfig

type NodeConfig

type NodeConfig struct {
	Address    string `mapstructure:"address"`
	Port       int    `mapstructure:"port"`
	Mode       string `mapstructure:"mode"`
	PrivateKey string `mapstructure:"private-key"`
	PublicKey  string `mapstructure:"public-key"`
}

func DefaultNodeConfig

func DefaultNodeConfig() *NodeConfig

Jump to

Keyboard shortcuts

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