The Watchtower Protocol (WTP) protobuf contract, plus committed generated code for Go and Rust.
This repository is the single source of truth for the WTP wire contract. The
.proto sources live under proto/, and the generated language
bindings under gen/ are committed to the repo so consumers can
depend on them directly without running protoc/buf themselves.
proto/canyonroad/wtp/v1/ # WTP service + message definitions (package canyonroad.wtp.v1)
proto/canyonroad/wtp/v1/ocsf/ # OCSF event payload schemas (package canyonroad.wtp.v1.ocsf)
gen/go/ # Generated Go module (+ hand-written validator)
gen/rust/ # Generated Rust crate (prost messages + tonic services)
buf.yaml # buf module + lint/breaking config
buf.gen.yaml # buf code-generation config
The generated Go code is its own module:
github.com/canyonroad/wtp-protos/gen/go
Import the WTP v1 messages/service and OCSF payloads via:
import (
wtpv1 "github.com/canyonroad/wtp-protos/gen/go/canyonroad/wtp/v1"
ocsfpb "github.com/canyonroad/wtp-protos/gen/go/canyonroad/wtp/v1/ocsf"
)The module also ships validate.go (package wtpv1), a hand-written validator
that is part of the WTP contract and is maintained alongside the generated code.
Build and test the Go module:
( cd gen/go && go build ./... && go test ./... )The generated Rust code is a crate named wtp-proto (gen/rust/). It
contains prost message types and tonic client/server service stubs. The crate
root (gen/rust/src/lib.rs) re-exports the modules under
wtp_proto::canyonroad::wtp::v1 (and ...::ocsf).
Build the crate:
( cd gen/rust && cargo build )Cargo.lock is not committed (this is a library crate); downstream consumers
resolve their own dependency versions.
The committed gen/ tree is produced by buf generate. To regenerate after
editing the .proto sources you need buf, the Go protoc plugins, and the Rust
protoc plugins installed:
go install github.com/bufbuild/buf/cmd/buf@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
cargo install protoc-gen-prost protoc-gen-prost-crate protoc-gen-tonicbuf invokes the local: plugins by binary name from PATH, so the Go bin dir
and the Cargo bin dir must both be on PATH for every buf/protoc
invocation:
export PATH="$(go env GOPATH)/bin:$HOME/.cargo/bin:$PATH"
buf lint
buf generategen/rust/Cargo.tomlis treated as a template by theprotoc-gen-prost-crateplugin: regeneration rewrites only the## @@protoc_insertion_point(features)section in place. The[package]and[dependencies]sections (includingtonic-prost, which tonic 0.14 split out of thetoniccrate for the prost codec) are preserved across regeneration.- The
buf.yamllint config usesSTANDARDbut excludes four naming-convention rules (PACKAGE_VERSION_SUFFIX,SERVICE_SUFFIX,RPC_REQUEST_STANDARD_NAME,RPC_RESPONSE_STANDARD_NAME). The WTP contract predates this repo and renaming the package/service/RPC types to satisfy those rules would break the existing wire/API contract.