Documentation
¶
Index ¶
- func ConfigDir() (string, error)
- func DecodeStrict(r io.Reader, out interface{}) error
- func DefaultPath(component string) (string, error)
- func EnsureConfigDir() (string, error)
- type ClientConfig
- type Config
- type DatabaseConfig
- type DiscoveryConfig
- type LoggingConfig
- type NodeConfig
- type SecurityConfig
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶ added in v0.51.5
ConfigDir returns the path to the DeBros config directory (~/.debros).
func DecodeStrict ¶ added in v0.51.5
DecodeStrict decodes YAML from a reader and rejects any unknown fields. This ensures the YAML only contains recognized configuration keys.
func DefaultPath ¶ added in v0.51.5
DefaultPath returns the path to the config file for the given component name. component should be e.g., "node.yaml", "bootstrap.yaml", "gateway.yaml"
func EnsureConfigDir ¶ added in v0.51.5
EnsureConfigDir creates the config directory if it does not exist.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
AppName string `yaml:"app_name"`
DatabaseName string `yaml:"database_name"`
BootstrapPeers []string `yaml:"bootstrap_peers"`
ConnectTimeout time.Duration `yaml:"connect_timeout"`
RetryAttempts int `yaml:"retry_attempts"`
}
ClientConfig represents configuration for network clients
type Config ¶
type Config struct {
Node NodeConfig `yaml:"node"`
Database DatabaseConfig `yaml:"database"`
Discovery DiscoveryConfig `yaml:"discovery"`
Security SecurityConfig `yaml:"security"`
Logging LoggingConfig `yaml:"logging"`
}
Config represents the main configuration for a network node
func (*Config) ParseMultiaddrs ¶
ParseMultiaddrs converts string addresses to multiaddr objects
type DatabaseConfig ¶
type DatabaseConfig struct {
DataDir string `yaml:"data_dir"`
ReplicationFactor int `yaml:"replication_factor"`
ShardCount int `yaml:"shard_count"`
MaxDatabaseSize int64 `yaml:"max_database_size"` // In bytes
BackupInterval time.Duration `yaml:"backup_interval"`
// RQLite-specific configuration
RQLitePort int `yaml:"rqlite_port"` // RQLite HTTP API port
RQLiteRaftPort int `yaml:"rqlite_raft_port"` // RQLite Raft consensus port
RQLiteJoinAddress string `yaml:"rqlite_join_address"` // Address to join RQLite cluster
}
DatabaseConfig contains database-related configuration
type DiscoveryConfig ¶
type DiscoveryConfig struct {
BootstrapPeers []string `yaml:"bootstrap_peers"` // Bootstrap peer addresses
DiscoveryInterval time.Duration `yaml:"discovery_interval"` // Discovery announcement interval
BootstrapPort int `yaml:"bootstrap_port"` // Default port for bootstrap nodes
HttpAdvAddress string `yaml:"http_adv_address"` // HTTP advertisement address
RaftAdvAddress string `yaml:"raft_adv_address"` // Raft advertisement
NodeNamespace string `yaml:"node_namespace"` // Namespace for node identifiers
}
DiscoveryConfig contains peer discovery configuration
type LoggingConfig ¶
type LoggingConfig struct {
Level string `yaml:"level"` // debug, info, warn, error
Format string `yaml:"format"` // json, console
OutputFile string `yaml:"output_file"` // Empty for stdout
}
LoggingConfig contains logging configuration
type NodeConfig ¶
type NodeConfig struct {
ID string `yaml:"id"` // Auto-generated if empty
Type string `yaml:"type"` // "bootstrap" or "node"
ListenAddresses []string `yaml:"listen_addresses"` // LibP2P listen addresses
DataDir string `yaml:"data_dir"` // Data directory
MaxConnections int `yaml:"max_connections"` // Maximum peer connections
}
NodeConfig contains node-specific configuration
type SecurityConfig ¶
type SecurityConfig struct {
EnableTLS bool `yaml:"enable_tls"`
PrivateKeyFile string `yaml:"private_key_file"`
CertificateFile string `yaml:"certificate_file"`
}
SecurityConfig contains security-related configuration
type ValidationError ¶ added in v0.51.5
type ValidationError struct {
Path string // e.g., "discovery.bootstrap_peers[0]"
Message string // e.g., "invalid multiaddr"
Hint string // e.g., "expected /ip{4,6}/.../tcp/<port>/p2p/<peerID>"
}
ValidationError represents a single validation error with context.
func (ValidationError) Error ¶ added in v0.51.5
func (e ValidationError) Error() string