Documentation
¶
Index ¶
- Constants
- func ConfigDir() string
- func ConfigPath() string
- func EnsureDirectories(cfg Config) error
- func OpenLogFile(path string) (io.WriteCloser, error)
- func Save(cfg Config) error
- func UseAgentPorts(cfg *Config)
- func UseMCPPorts(cfg *Config)
- func UseSurfacePorts(cfg *Config, inbound, outbound int)
- func ValidPeerPort(port int) bool
- func WriteDefault() error
- type Config
Constants ¶
const ( MinPeerPort = 26000 MaxPeerPort = 27000 )
Peer connection ports must fall in this range. Handshake and relay registration reject anything outside it.
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. GRPCStreamBuffer must stay below GRPCMaxMsgSize to leave room for protobuf framing overhead.
const ( GRPCWindowSize = 16 << 20 // 16 MiB - per-stream and per-connection HTTP/2 window GRPCIOBufferSize = 4 << 20 // 4 MiB - read/write buffer for gRPC transport )
HTTP/2 flow-control tuning for bulk transfer. Go gRPC defaults (64 KiB window, 32 KiB buffers) throttle large file streams on fast networks.
const ( MaxReadAheadWindowMB = 1024 // 64 read-ahead blocks of 16 MiB MaxPrefetchAutoMB = 1 << 20 // 1 TiB )
Limits of the number settings.
const AgentInboundPort = 26441
One pair per surface. The app, the agent and the MCP server get installed on the same machine, and one pair meant the second to start could not bind.
const AgentOutboundPort = 26442
const BlockSize = 4 * 1024 * 1024 // 4 MiB. Larger chunks reduce gRPC round-trips over WAN.
const DefaultBridge = "bridge.keibisoft.com:26600"
const DefaultRelay = "https://keibidroprelay.keibisoft.com/"
const InboundPort = 26431
The desktop app's default port pair.
const LogRotateBytes = 32 << 20
LogRotateBytes caps one log file. Past it the file becomes <path>.1, replacing the previous .1, and a fresh file starts, so an install keeps at most two of them. Nothing trimmed the log before: five months of the desktop app at debug level had reached 151 MB in one file (2026-09-15).
const MCPInboundPort = 26451
const MCPOutboundPort = 26452
const OutboundPort = 26432
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the config directory path (~/.config/keibidrop/). KEIBIDROP_CONFIG_DIR overrides it, so tests can run multiple instances on one machine.
func EnsureDirectories ¶
EnsureDirectories creates save_path, the log directory, and, except on Windows, mount_path. WinFSP creates the mount point itself and rejects an existing path; libfuse and macFUSE require it.
func OpenLogFile ¶ added in v0.4.8
func OpenLogFile(path string) (io.WriteCloser, error)
OpenLogFile opens path for appending and rotates it as it grows. Every binary that writes a log file opens it here.
func Save ¶ added in v0.2.0
Save writes the config to the standard path (~/.config/keibidrop/config.toml).
func UseAgentPorts ¶ added in v0.4.8
func UseAgentPorts(cfg *Config)
UseAgentPorts is UseSurfacePorts for the kd agent.
func UseMCPPorts ¶ added in v0.4.8
func UseMCPPorts(cfg *Config)
UseMCPPorts is UseSurfacePorts for the MCP server.
func UseSurfacePorts ¶ added in v0.4.8
UseSurfacePorts moves a config off the app's default port pair on to another surface's. Every surface reads the same config.toml, which the app writes with its own defaults, so a port still equal to the app default counts as unchosen. Anything else, and KD_INBOUND_PORT or KD_OUTBOUND_PORT, is left alone.
func ValidPeerPort ¶ added in v0.3.3
ValidPeerPort reports whether port is within the allowed peer port range.
func WriteDefault ¶
func WriteDefault() error
WriteDefault creates a commented default config file at the standard path. It does nothing when the file 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"`
Incognito bool `toml:"incognito"`
PrefetchOnOpen bool `toml:"prefetch_on_open"`
PrefetchAutoMB int `toml:"prefetch_auto_mb"` // Prefetch files at or above this many MB. Default 0 is off because prefetch saturates slow links and starves seeks.
ReadAheadWindowMB int `toml:"read_ahead_window_mb"` // Cap in MB for sequential read-ahead; prevents stalls at block boundaries on high-RTT links. Self-tunes below the cap. Default 64; 0 disables.
PushOnWrite bool `toml:"push_on_write"`
LiveCollab bool `toml:"live_collab"` // Show peers' same-size in-place edits live (macFUSE auto_cache); risks local mmap-write integrity (git).
PassphraseProtect bool `toml:"passphrase_protect"` // Enable Tier 2 identity at-rest encryption with an Argon2id passphrase.
AutoConnectPeer string `toml:"auto_connect_peer"` // Saved contact (name or fingerprint) to connect to on startup, with retry.
MountReadOnly bool `toml:"mount_read_only"` // Local FUSE mount returns EROFS on write ops. Keeps the local view equal to the origin.
PreserveMetadata bool `toml:"preserve_metadata"` // Apply the origin's mode and timestamps to files saved on disk.
UpdateCheck bool `toml:"update_check"` // Fetch the newest version number from keibidrop.com at start and show a notice when this build is older.
}
Config holds all user-configurable settings. Values resolve in this order: built-in defaults, config file, environment variables.
func Load ¶
Load reads the config file, if present, and applies environment variable overrides. A missing config file is not an error; defaults apply.
func (*Config) ResetTunables ¶ added in v0.5.0
func (c *Config) ResetTunables()
ResetTunables puts every value SetTunable changes back to its default.
func (*Config) SetTunable ¶ added in v0.5.0
SetTunable sets one Settings card value from its text. It refuses an unknown key, a value of the wrong kind and a number out of range, and then changes nothing.