Documentation
¶
Index ¶
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 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
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 Save ¶ added in v0.2.0
Save writes the config to the standard path (~/.config/keibidrop/config.toml).
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 (receiver courtesy).
PreserveMetadata bool `toml:"preserve_metadata"` // Apply the origin's mode and timestamps to files saved on disk.
}
Config holds all user-configurable settings. Values resolve in this order: built-in defaults, config file, environment variables.