guard/api/v1/guard.proto

85 lines
1.9 KiB
Protocol Buffer
Raw Normal View History

2019-07-10 20:59:43 +00:00
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 {
2019-07-11 11:46:36 +00:00
// Create a new tunnel
2019-07-10 21:35:46 +00:00
rpc Create(CreateRequest) returns (TunnelResponse);
2019-07-11 11:46:36 +00:00
// Delete a tunnel
2019-07-10 20:59:43 +00:00
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
2019-07-11 11:46:36 +00:00
// List all tunnels
2019-07-10 20:59:43 +00:00
rpc List(google.protobuf.Empty) returns (ListResponse);
2019-07-11 11:46:36 +00:00
// NewPeer to the tunnel with gernerated keys
rpc NewPeer(NewPeerRequest) returns (PeerResponse);
// DeletePeer from a tunnel
2019-07-10 21:35:46 +00:00
rpc DeletePeer(DeletePeerRequest) returns (TunnelResponse);
2019-07-10 20:59:43 +00:00
}
message CreateRequest {
2019-07-11 11:46:36 +00:00
// id of the tunnel
2019-07-10 20:59:43 +00:00
string id = 1 [(gogoproto.customname) = "ID"];
2019-07-11 11:46:36 +00:00
string endpoint = 2;
2019-07-10 20:59:43 +00:00
string address = 3;
}
2019-07-10 21:35:46 +00:00
message TunnelResponse {
2019-07-10 20:59:43 +00:00
Tunnel tunnel = 1;
}
2019-07-11 11:46:36 +00:00
message PeerResponse {
Tunnel tunnel = 1;
Peer peer = 2;
}
message NewPeerRequest {
// id of the tunnel
string id = 1 [(gogoproto.customname) = "ID"];
string peer_id = 2 [(gogoproto.customname) = "PeerID"];
string address = 3;
}
2019-07-10 21:35:46 +00:00
message DeletePeerRequest {
2019-07-11 11:46:36 +00:00
// id of the tunnel
2019-07-10 21:35:46 +00:00
string id = 1 [(gogoproto.customname) = "ID"];
string peer_id = 2 [(gogoproto.customname) = "PeerID"];
}
2019-07-10 20:59:43 +00:00
message DeleteRequest {
2019-07-11 11:46:36 +00:00
// id of the tunnel
2019-07-10 20:59:43 +00:00
string id = 1 [(gogoproto.customname) = "ID"];
}
message ListResponse {
repeated Tunnel tunnels = 1;
}
message Tunnel {
string id = 1 [(gogoproto.customname) = "ID"];
string private_key = 2;
2019-07-11 11:46:36 +00:00
string listen_port = 3;
2019-07-10 20:59:43 +00:00
string address = 4;
string dns = 5 [(gogoproto.customname) = "DNS"];
repeated Peer peers = 6;
Masquerade masquerade = 7;
2019-07-11 11:46:36 +00:00
string public_key = 8;
string endpoint = 9;
2019-07-10 20:59:43 +00:00
}
message Peer {
2019-07-10 21:35:46 +00:00
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;
2019-07-11 11:46:36 +00:00
string private_key = 6;
2019-07-10 20:59:43 +00:00
}
message Masquerade {
string interface = 1;
}