Skip to main content

Crate snip_sync

Crate snip_sync 

Source

Re-exports§

pub use db::Database;
pub use metrics::Metrics;
pub use premade::PremadeManager;
pub use rate_limiter::RateLimiter;

Modules§

bootstrap
cert
cli
db
editor
http
The snip-sync health and metrics HTTP control surface.
metrics
orchestration
Server shutdown orchestration.
paths
premade
process
Process helpers used by stop/restart and the croncheck maintenance lock.
rate_limiter
server_lock
Kernel-backed singleton lock for the snip-sync server.
startup
Cross-platform startup registration for the foreground snip-sync server.
toml_escapes
TOML escape sequence handling for premade libraries.

Structs§

AppState
Config
ConfigFile
CorsConfig
DatabaseConfig
LimitsConfig
MetricsConfig
PremadeConfig
RateLimitConfig
ServerConfig
SnipSyncService

Enums§

ConfigLoadError

Constants§

DEFAULT_DB_MAX_CONNECTIONS
DEFAULT_GRPC_MAX_MESSAGE_SIZE
DEFAULT_MAX_API_KEY_LENGTH
DEFAULT_MAX_COMMAND_LENGTH
DEFAULT_MAX_DESCRIPTION_LENGTH
DEFAULT_MAX_DEVICE_ID_LENGTH
DEFAULT_MAX_ENCRYPTED_PAYLOAD_LENGTH
DEFAULT_MAX_ID_LENGTH
DEFAULT_MAX_SYNC_SNIPPETS
DEFAULT_MAX_TAGS
DEFAULT_MAX_TAG_LENGTH
DEFAULT_METRICS_AUTH_FAILURES_PER_MINUTE
Global ceiling on failed /metrics authentications per minute. Correct credentials never consume it, so an attacker cannot deny the operator their own scrape by burning the budget.
DEFAULT_RATE_LIMIT_PER_MINUTE
DEFAULT_REGISTER_PER_MINUTE
Global ceiling on successful account creations per minute, independent of the caller’s address. The per-peer register:<peer> budget alone lets an attacker with many addresses grow the user table without bound.
DEFAULT_REQUEST_TIMEOUT_SECS
MAX_REQUEST_LIMIT
Hard upper bound for any single request’s page size. Endpoints choose their own default page size when the client omits one (sync → 1000, get_snippets → 100, list_libraries → 50); all are clamped here.
PRE_AUTH_RATE_LIMIT_MULTIPLIER
Multiplier applied to the per-peer budget for requests that have not yet authenticated. The pre-authentication budget only has to bound the cost of an API-key lookup, so it is generous by design: an unauthenticated caller must not be able to exhaust the budget that legitimate callers spend on the authenticated surface.

Functions§

extract_api_key
Extract the API key from a gRPC request’s authorization metadata. Falls back to the body api_key field for backward compatibility.
parse_bool_env
Parse an optional boolean environment variable.
parse_env
Parse an optional environment variable, returning the typed value if present and valid.