Artifact 84b739e2a2b064e153fa035ade55c6e39d7f89b3d64af157ded12cf8e175228b:
- File bridge/README.md — part of check-in [28f11dc3c4] at 2026-04-27 19:51:26 on branch trunk — pre-public: LICENSE, untrack .mcp.json, placeholder IPs, module READMEs, fix wasm targets (user: [email protected], size: 1696) [annotate] [blame] [check-ins using] [more...]
bridge
NATS-to-HTTP translator for talking to an unmodified Fossil server. One project per bridge instance.
Module path: github.com/danmestas/EdgeSync/bridge
What it does
Subscribes to <prefix>.<project-code>.sync, decodes incoming xfer messages, proxies them to a Fossil HTTP server via libfossil.NewHTTPTransport, and replies on the NATS request/reply channel.
The bridge is the legacy path: leaf agents only need it to interoperate with a stock Fossil binary. Pure leaf-to-leaf deployments don't run a bridge at all.
Decode failures and HTTP errors produce an empty response — never leave the leaf hanging, never crash.
Public API surface
bridge.Config—FossilURL,ProjectCode,NATSUrl,SubjectPrefixbridge.New(Config),(*Bridge).Start(),Stop()
| Config Field | Default | CLI Flag | Env Var |
|---|---|---|---|
FossilURL |
(required) | --fossil |
BRIDGE_FOSSIL_URL |
ProjectCode |
(required) | --project |
BRIDGE_PROJECT_CODE |
NATSUrl |
nats://localhost:4222 |
--nats |
BRIDGE_NATS_URL |
SubjectPrefix |
"fossil" |
--prefix |
BRIDGE_PREFIX |
CLI: cmd/bridge/main.go.
Build & test
cd bridge && go build -buildvcs=false -o ../bin/bridge ./cmd/bridge # or `make bridge`
cd bridge && go test ./... -short -count=1
Where it fits
Optional middle tier. The leaf agent and the bridge must agree on SubjectPrefix for a given project. JetStream is a drop-in upgrade — replace Request with publish/consume, the Exchange signature is unchanged.
See docs/architecture/agent-deployment.md (Bridge Architecture section) for full details.