Repository navigation
Expand file tree
/
Copy pathwghost.proto
More file actions
112 lines (87 loc) · 3.47 KB
/
Copy pathwghost.proto
File metadata and controls
112 lines (87 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
This file is part wghost.
Wghost is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with wghost. If not, see <https://www.gnu.org/licenses/>.
*/
syntax = "proto3";
package wghost;
import "google/protobuf/timestamp.proto";
service Wg {
rpc AddPeer (PeerConfig) returns (ConfigSuccess) {}
rpc SetPeers (PeerConfigList) returns (ConfigSuccess) {}
rpc GetPeer (PeerQuery) returns (Peer) {}
rpc ListPeers (PeerListQuery) returns (PeerList) {}
}
message PeerConfig {
// PublicKey is the public key of a peer, computed from its private key.
string PublicKey = 1;
// PresharedKey is an optional preshared key which may be used as an
// additional layer of security for peer communications.
string PresharedKey = 2;
// AllowedIPs specifies which IPv4 and IPv6 addresses this peer is allowed
// to communicate on.
//
// 0.0.0.0/0 indicates that all IPv4 addresses are allowed, and ::/0
// indicates that all IPv6 addresses are allowed.
repeated string AllowedIPs = 3;
}
message PeerConfigList {
// ReplacePeers specifies if the Peers in this configuration should replace
// the existing peer list, instead of appending them to the existing list.
bool ReplacePeers = 1;
// Peers specifies a list of peer configurations to apply to a device.
repeated PeerConfig Peers = 2;
}
message PeerQuery {
// PublicKey is the public key of a peer, computed from its private key.
string PublicKey = 1;
}
message Endpoint {
string IP = 1;
int32 Port = 2;
string Zone = 3;
}
message Peer {
// PublicKey is the public key of a peer, computed from its private key.
string PublicKey = 1;
// PresharedKey is an optional preshared key which may be used as an
// additional layer of security for peer communications.
string PresharedKey = 2;
// Endpoint is the most recent source address used for communication by
// this Peer.
Endpoint Endpoint = 3;
// LastHandshakeTime indicates the most recent time a handshake was performed
// with this peer.
//
// A zero-value time.Time indicates that no handshake has taken place with
// this peer.
google.protobuf.Timestamp LastHandshakeTime = 4;
// ReceiveBytes indicates the number of bytes received from this peer.
int64 ReceiveBytes = 5;
// TransmitBytes indicates the number of bytes transmitted to this peer.
int64 TransmitBytes = 6;
// AllowedIPs specifies which IPv4 and IPv6 addresses this peer is allowed
// to communicate on.
//
// 0.0.0.0/0 indicates that all IPv4 addresses are allowed, and ::/0
// indicates that all IPv6 addresses are allowed.
repeated string AllowedIPs = 7;
// ProtocolVersion specifies which version of the WireGuard protocol is used
// for this Peer.
//
// A value of 0 indicates that the most recent protocol version will be used.
int32 ProtocolVersion = 8;
}
message ConfigSuccess {}
message PeerListQuery {}
message PeerList {
repeated Peer Peers = 1;
}