Skip to main content

Crate interloper_server

Crate interloper_server 

Source
Expand description

HTTP API over interloper.

route
GET /healthliveness, no auth, not rate limited
GET /v1/providersmeasured health matrix
DELETE /v1/providers/{name}/quarantinereturn a quarantined provider to routing
POST /v1/inboxesissue an address
GET /v1/inboxes/{addr}/messageslist
GET /v1/inboxes/{addr}/messages/{id}read one, with its OTP
DELETE /v1/inboxes/{addr}/messages/{id}delete
GET /v1/inboxes/{addr}/waitlong-poll for the next (matching) message
GET /v1/inboxes/{addr}/eventsServer-Sent Events: every message as it lands
POST/GET /v1/webhooks, DELETE /v1/webhooks/{id}one-shot outbound webhooks

Every response is {"success", "data", "error"}. Auth is X-API-Key. With a Postgres URL, instances share addresses and health: see fleet.

Modules§

config
Server settings, from the environment.
error
HTTP errors. Clients get a fixed message per kind; detail goes to the log.
fleet
Fleet mode: several servers sharing one Postgres.
ratelimit
Token buckets, keyed so one noisy client cannot spend another’s budget.
service
The logic the routes call. Routes own HTTP; this owns everything else.
store
Where the server keeps the addresses it issued.
webhooks
One-shot outbound webhooks: “POST me the next message to this address”.

Structs§

AppState

Functions§

envelope
The one response shape. success is derived from error, so a body can never claim success while carrying one.
envelope_err
message_json
The one shape a message takes on the wire: .../messages/{id}, wait, SSE and webhook payloads alike.
router
serve
Run the server until Ctrl-C/SIGTERM. Refuses to start without API keys.