feature: Adds working codegen.
This commit is contained in:
parent
594c2c4202
commit
ba53b7a25d
7 changed files with 142 additions and 2 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.go
|
||||||
|
*.rs
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "go-capnp"]
|
||||||
|
path = go-capnp
|
||||||
|
url = https://github.com/capnproto/go-capnp.git
|
|
@ -1,2 +0,0 @@
|
||||||
# hermes-backend-typings
|
|
||||||
|
|
126
data.capnp
Normal file
126
data.capnp
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
@0x92a7c8962141ef12;
|
||||||
|
|
||||||
|
using Go = import "/go.capnp";
|
||||||
|
$Go.package("commonbackend");
|
||||||
|
$Go.import("git.terah.dev/imterah/hermes/backend/commonbackend");
|
||||||
|
|
||||||
|
enum Protocol {
|
||||||
|
tcp @0;
|
||||||
|
udp @1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum StatusCode {
|
||||||
|
success @0;
|
||||||
|
failure @1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Start {
|
||||||
|
id @0 :UInt8 = 0;
|
||||||
|
arguments @1 :Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Stop {
|
||||||
|
id @0 :UInt8 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AddProxy {
|
||||||
|
id @0 :UInt8 = 2;
|
||||||
|
sourceIP @1 :Data;
|
||||||
|
sourcePort @2 :UInt16;
|
||||||
|
destPort @3 :UInt16;
|
||||||
|
protocol @4 :Protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct RemoveProxy {
|
||||||
|
id @0 :UInt8 = 3;
|
||||||
|
sourceIP @1 :Data;
|
||||||
|
sourcePort @2 :UInt16;
|
||||||
|
destPort @3 :UInt16;
|
||||||
|
protocol @4 :Protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyStatusRequest {
|
||||||
|
id @0 :UInt8 = 4;
|
||||||
|
sourceIP @1 :Data;
|
||||||
|
sourcePort @2 :UInt16;
|
||||||
|
destPort @3 :UInt16;
|
||||||
|
protocol @4 :Protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyStatusResponse {
|
||||||
|
id @0 :UInt8 = 5;
|
||||||
|
sourceIP @1 :Data;
|
||||||
|
sourcePort @2 :UInt16;
|
||||||
|
destPort @3 :UInt16;
|
||||||
|
protocol @4 :Protocol;
|
||||||
|
isActive @5 :Bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyInstanceRequest {
|
||||||
|
id @0 :UInt8 = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyInstanceResponse {
|
||||||
|
id @0 :UInt8 = 7;
|
||||||
|
proxies @1 :List(ProxyInstance);
|
||||||
|
|
||||||
|
struct ProxyInstance {
|
||||||
|
sourceIP @0 :Text;
|
||||||
|
sourcePort @1 :UInt16;
|
||||||
|
destPort @2 :UInt16;
|
||||||
|
protocol @3 :Protocol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BackendStatusRequest {
|
||||||
|
id @0 :UInt8 = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BackendStatusResponse {
|
||||||
|
id @0 :UInt8 = 9;
|
||||||
|
isRunning @1 :Bool;
|
||||||
|
statusCode @2 :StatusCode;
|
||||||
|
message @3 :Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyConnectionsRequest {
|
||||||
|
id @0 :UInt8 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProxyConnectionsResponse {
|
||||||
|
id @0 :UInt8 = 11;
|
||||||
|
connections @1 :List(Connection);
|
||||||
|
|
||||||
|
struct Connection {
|
||||||
|
sourceIP @0 :Data;
|
||||||
|
sourcePort @1 :UInt16;
|
||||||
|
destPort @2 :UInt16;
|
||||||
|
clientIP @3 :Data;
|
||||||
|
clientPort @4 :UInt16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckClientParameters {
|
||||||
|
id @0 :UInt8 = 12;
|
||||||
|
sourceIP @1 :Data;
|
||||||
|
sourcePort @2 :UInt16;
|
||||||
|
destPort @3 :UInt16;
|
||||||
|
protocol @4 :Protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckServerParameters {
|
||||||
|
id @0 :UInt8 = 13;
|
||||||
|
arguments @1 :Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckParametersResponse {
|
||||||
|
id @0 :UInt8 = 14;
|
||||||
|
inResponseTo @1 :InResponseTo;
|
||||||
|
isValid @2 :Bool;
|
||||||
|
message @3 :Text;
|
||||||
|
|
||||||
|
enum InResponseTo {
|
||||||
|
checkClientParameters @0;
|
||||||
|
checkServerParameters @1;
|
||||||
|
}
|
||||||
|
}
|
1
go-capnp
Submodule
1
go-capnp
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f9295d9b67d8cf9f3f992cb70e793c09f0b2b2d5
|
3
scripts/go-build.sh
Executable file
3
scripts/go-build.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo $PATH
|
||||||
|
capnp compile -I ./go-capnp/std -ogo ./*.capnp
|
7
shell.nix
Normal file
7
shell.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
}: pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
capnproto
|
||||||
|
];
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue