config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveConfig

func SaveConfig(path string, cfg *Config) error

SaveConfig saves configuration to a file

Types

type ClientConfig

type ClientConfig struct {
	ServerURL string `json:"server_url"` // Server URL (e.g., "http://95.145.216.175")
	ChunkSize int    `json:"chunk_size"` // Chunk size in bytes
	Token     string `json:"token"`      // Authentication token (optional)
}

ClientConfig holds client configuration

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

DefaultClientConfig returns default client configuration

type Config

type Config struct {
	Server ServerConfig `json:"server"`
	Client ClientConfig `json:"client"`
}

Config holds both server and client configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads configuration from a file

func LoadOrCreateConfig

func LoadOrCreateConfig(path string) (*Config, error)

LoadOrCreateConfig loads config from file, or creates default if not exists

type ServerConfig

type ServerConfig struct {
	Address     string `json:"address"`     // Listen address (e.g., "0.0.0.0:80")
	StorageDir  string `json:"storage_dir"` // Storage directory path
	MetaDir     string `json:"meta_dir"`    // Metadata directory for resume
	TokensFile  string `json:"tokens_file"` // Path to tokens file (empty to disable auth)
	TLSCertFile string `json:"tls_cert"`    // TLS certificate file (empty for HTTP)
	TLSKeyFile  string `json:"tls_key"`     // TLS key file (empty for HTTP)
}

ServerConfig holds server configuration

func DefaultServerConfig

func DefaultServerConfig() ServerConfig

DefaultServerConfig returns default server configuration

Jump to

Keyboard shortcuts

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