config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPCMaxMsgSize   = 20 * 1024 * 1024                  // 20 MiB - max gRPC message size
	GRPCStreamBuffer = 16 * 1024 * 1024                  // 16 MiB - buffer for streaming reads
	GRPCOverheadRoom = GRPCMaxMsgSize - GRPCStreamBuffer // 4 MiB headroom
)

gRPC message size limits IMPORTANT: GRPCStreamBuffer MUST be smaller than GRPCMaxMsgSize to leave room for protobuf framing overhead (~10-20 bytes per message)

View Source
const BlockSize = 4 * 1024 * 1024 // 4 MiB - larger chunks = fewer gRPC round-trips over WAN
View Source
const DefaultRelay = "https://keibidroprelay.keibisoft.com/"
View Source
const InboundPort = 26431
View Source
const OutboundPort = 26432

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the config directory path (~/.config/keibidrop/).

func ConfigPath

func ConfigPath() string

ConfigPath returns the config file path.

func EnsureDirectories

func EnsureDirectories(cfg Config) error

EnsureDirectories creates save_path, mount_path, and log directory if they don't exist.

func WriteDefault

func WriteDefault() error

WriteDefault creates a default config file with comments at the standard path. Does nothing if the file already exists.

Types

type Config

type Config struct {
	Relay          string `toml:"relay"`
	SavePath       string `toml:"save_path"`
	MountPath      string `toml:"mount_path"`
	LogFile        string `toml:"log_file"`
	InboundPort    int    `toml:"inbound_port"`
	OutboundPort   int    `toml:"outbound_port"`
	BridgeAddr     string `toml:"bridge_addr"` // TCP bridge relay address
	StrictMode     bool   `toml:"strict_mode"` // Disable data relay fallback
	NoFUSE         bool   `toml:"no_fuse"`
	PrefetchOnOpen bool   `toml:"prefetch_on_open"`
	PushOnWrite    bool   `toml:"push_on_write"`
}

Config holds all user-configurable settings. Resolution order: built-in defaults → config file → environment variables.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns platform-aware defaults.

func Load

func Load() (Config, error)

Load reads the config file (if it exists) and applies environment variable overrides. Missing config file is not an error — defaults are used.

Jump to

Keyboard shortcuts

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