guard/api/v1/guard.proto
2019-07-10 21:35:46 +00:00

66 lines
1.5 KiB
Protocol Buffer

syntax = "proto3";
package com.crosbymichael.guard.v1;
import weak "gogoproto/gogo.proto";
import "google/protobuf/empty.proto";
option go_package = "github.com/crosbymichael/guard/api/v1;v1";
service Wireguard {
rpc Create(CreateRequest) returns (TunnelResponse);
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
rpc List(google.protobuf.Empty) returns (ListResponse);
rpc AddPeer(AddPeerRequest) returns (TunnelResponse);
rpc DeletePeer(DeletePeerRequest) returns (TunnelResponse);
}
message CreateRequest {
string id = 1 [(gogoproto.customname) = "ID"];
uint32 listen_port = 2;
string address = 3;
}
message TunnelResponse {
Tunnel tunnel = 1;
}
message AddPeerRequest {
string id = 1 [(gogoproto.customname) = "ID"];
Peer peer = 2;
}
message DeletePeerRequest {
string id = 1 [(gogoproto.customname) = "ID"];
string peer_id = 2 [(gogoproto.customname) = "PeerID"];
}
message DeleteRequest {
string id = 1 [(gogoproto.customname) = "ID"];
}
message ListResponse {
repeated Tunnel tunnels = 1;
}
message Tunnel {
string id = 1 [(gogoproto.customname) = "ID"];
string private_key = 2;
uint32 listen_port = 3;
string address = 4;
string dns = 5 [(gogoproto.customname) = "DNS"];
repeated Peer peers = 6;
Masquerade masquerade = 7;
}
message Peer {
string id = 1 [(gogoproto.customname) = "ID"];
string public_key = 2;
repeated string allowed_ips = 3 [(gogoproto.customname) = "AllowedIPs"];
string endpoint = 4;
uint32 persistent_keepalive = 5;
}
message Masquerade {
string interface = 1;
}