Brave Sync Server v2
A sync server implemented in go to communicate with Brave sync clients using components/sync/protocol/sync.proto. Current Chromium version for sync protocol buffer files used in this repo is Chromium 116.0.5845.183.
This server supports endpoints as bellow.
- The
POST /v2/command/endpoint handles Commit and GetUpdates requests from sync clients and return corresponding responses both in protobuf format. Detailed of requests and their corresponding responses are defined inschema/protobuf/sync_pb/sync.proto. Sync clients are responsible for generating valid access tokens and present them to the server in the Authorization header of requests.
schema/dynamodb/table.json.
Developer Setup
- Install Go 1.22
- Install GolangCI-Lint
- Install gowrap
- Clone this repo
- Install protobuf protocol compiler if you need to compile protobuf files, which could be built using
make protobuf. - Build via
make
Local development using Docker and DynamoDB Local
- Clone this repo
- Run
make docker - Run
make docker-up - To connect to your local server from a Brave browser client use
--sync-url="http://localhost:8295/v2" - For running unit tests, run
make docker-test
Updating protocol definitions
- Copy the
.protofiles fromcomponents/sync/protocolinchromiumtoschema/protobuf/sync_pbingo-sync. - Copy the
.protofiles fromcomponents/sync/protocolinbrave-coretoschema/protobuf/sync_pbingo-sync. - Run
make repath-prototo set correct import paths in.protofiles. - Run
make proto-go-moduleto add thego_moduleoption to.protofiles. - Run
make protobufto generate the Go code from.protodefinitions.
Prometheus Instrumentation
The instrumented datastore and redis interfaces are generated, providing integration with Prometheus. The following will re-generate the instrumented code, required when updating protocl definitions:make instrumented
Changes to datastore/datastore.go or cache/cache.go should be followed with the above command.