config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides configuration management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version   string            `yaml:"version"`
	LogLevel  string            `yaml:"log_level"`
	Protocols []ProtocolConfig  `yaml:"protocols"`
	TLS       TLSConfig         `yaml:"tls"`
	Options   map[string]string `yaml:"options"`
}

Config represents the main configuration.

func Default

func Default() *Config

Default returns the default configuration.

func (*Config) GetProtocolConfigs

func (c *Config) GetProtocolConfigs() []ProtocolConfig

GetProtocolConfigs returns protocol configurations.

type Manager

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

Manager handles configuration loading and reloading.

func NewManager

func NewManager() *Manager

NewManager creates a new configuration manager.

func (*Manager) Get

func (m *Manager) Get() *Config

Get returns the current configuration.

func (*Manager) Load

func (m *Manager) Load(path string) error

Load loads configuration from a file.

func (*Manager) Reload

func (m *Manager) Reload() error

Reload reloads the configuration from the file.

func (*Manager) Save

func (m *Manager) Save(path string) error

Save saves configuration to a file.

func (*Manager) SetOnReload

func (m *Manager) SetOnReload(cb func(*Config))

SetOnReload sets the reload callback.

type ProtocolConfig

type ProtocolConfig struct {
	Name    string            `yaml:"name"`
	Listen  string            `yaml:"listen"`
	Target  string            `yaml:"target"`
	Enabled bool              `yaml:"enabled"`
	Options map[string]string `yaml:"options"`
}

ProtocolConfig represents a protocol configuration.

type TLSConfig

type TLSConfig struct {
	CertFile string `yaml:"cert_file"`
	KeyFile  string `yaml:"key_file"`
	CAFile   string `yaml:"ca_file"`
}

TLSConfig represents TLS configuration.

Jump to

Keyboard shortcuts

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