Skip to content

Commit

Permalink
Protocol design
Browse files Browse the repository at this point in the history
  • Loading branch information
seamlik committed Mar 2, 2024
0 parents commit a180f70
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/* text eol=lf
23 changes: 23 additions & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
- push
- pull_request
jobs:
main:
runs-on: ubuntu-22.04
steps:
# Setup
- uses: actions/checkout@v4
- uses: seamlik/devops/.github/actions/cache-rust
- uses: seamlik/devops/.github/actions/cache-nodejs
- run: npm install --global prettier
- uses: bufbuild/buf-setup-action@v1
- uses: seamlik/devops/.github/actions/install-devops
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Verify
- run: cargo test
- run: devops format rust yaml markdown protobuf
- uses: seamlik/devops/.github/actions/check-formatting
- uses: bufbuild/buf-lint-action@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target/
/Cargo.lock
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[workspace]
members = ["protocol/rust"]
resolver = "2"

[workspace.package]
edition = "2021"
publish = false
version = "0.1.0"
4 changes: 4 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License

This is not free software.
All rights reserved.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Tansa: LAN service discovery over multicast

Work in progress.

## Project name meaning

Based on Japanese 探索 with pronounciation "tansaku" meaning "discovery".
3 changes: 3 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- protocol/grpc
5 changes: 5 additions & 0 deletions protocol/grpc/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v1
lint:
except:
- RPC_REQUEST_STANDARD_NAME
- RPC_RESPONSE_STANDARD_NAME
10 changes: 10 additions & 0 deletions protocol/grpc/tw/seamlik/tansa/v1/request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package tw.seamlik.tansa.v1;

import "tw/seamlik/tansa/v1/socket_address.proto";

message Request {
bytes request_id = 1;
SocketAddress response_collector_address = 2;
}
11 changes: 11 additions & 0 deletions protocol/grpc/tw/seamlik/tansa/v1/response.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package tw.seamlik.tansa.v1;

import "tw/seamlik/tansa/v1/socket_address.proto";

message Response {
bytes request_id = 1;
bytes response_id = 2;
SocketAddress endpoint_address = 3;
}
10 changes: 10 additions & 0 deletions protocol/grpc/tw/seamlik/tansa/v1/response_collector_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package tw.seamlik.tansa.v1;

import "google/protobuf/empty.proto";
import "tw/seamlik/tansa/v1/response.proto";

service ResponseCollectorService {
rpc SubmitResponse(Response) returns (google.protobuf.Empty) {}
}
8 changes: 8 additions & 0 deletions protocol/grpc/tw/seamlik/tansa/v1/socket_address.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax = "proto3";

package tw.seamlik.tansa.v1;

message SocketAddress {
bytes ipv6 = 1;
uint32 port = 2;
}
13 changes: 13 additions & 0 deletions protocol/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
edition.workspace = true
name = "tansa-protocol"
publish.workspace = true
version.workspace = true

[dependencies]
tonic = "0.11"
prost = "0.12"
prost-types = "0.12"

[build-dependencies]
tonic-build = "0.11"
6 changes: 6 additions & 0 deletions protocol/rust/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() -> std::io::Result<()> {
tonic_build::configure().compile(
&["../grpc/tw/seamlik/tansa/v1/response_collector_service.proto"],
&["../grpc"],
)
}
3 changes: 3 additions & 0 deletions protocol/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Generated gRPC definitions.

tonic::include_proto!("tw.seamlik.tansa.v1");

0 comments on commit a180f70

Please sign in to comment.