Skip to content

Commit ea9e51b

Browse files
committed
[ME-4826] Propagate Peer Private IP Addresses
1 parent af5034e commit ea9e51b

14 files changed

Lines changed: 977 additions & 692 deletions

common/messages.pb.go

Lines changed: 438 additions & 256 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/messages.proto

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import "google/protobuf/struct.proto";
1111
import "google/protobuf/timestamp.proto";
1212

1313
message DiscoveryDetailsMessage {
14-
bool discoverable = 1; // whether the peer should be returned along with the networks it's in
15-
string endpoint_public_udp4 = 2; // the endpoint (IPv4 + port) to send packets to for the peer
16-
string endpoint_public_udp6 = 3; // the endpoint (IPv6 + port) to send packets to for the peer
17-
string public_key = 4; // the public key of the peer, only used in connector
14+
bool discoverable = 1; // whether the peer should be returned along with the networks it's in
15+
string endpoint_public_udp4 = 2 [deprecated = true]; // the endpoint (IPv4 + port) to send packets to for the peer
16+
string endpoint_public_udp6 = 3 [deprecated = true]; // the endpoint (IPv6 + port) to send packets to for the peer
17+
string public_key = 4; // the public key of the peer, only used in connector
18+
repeated IPAddrPort addresses = 5; // all ip address and port combinations that the peer can tx/rx traffic
1819
}
1920

2021
message HeartbeatMessage {}
@@ -75,11 +76,12 @@ message WireGuardPeer {
7576
string ipv6 = 3; // the peer's (private) IPv6 address in the WireGuard network
7677
repeated string allowed_ips = 4 [deprecated = true]; // list of routes (CIDRs) to be routed through this peer (most peers will just have their own IP/32). (this field is now deprecated in favor of building the allowed_ips list from ipv4 + ipv6 + service ips + subnet routes)
7778
uint32 persistent_keepalive_interval_seconds = 5; // the interval for sending keepalive packets (0 means disabled)
78-
string public_udp4_endpoint = 6; // endpoint for UDP peer-to-peer communication over IPv4 (public IPv4 + port as seen from the Internet)
79-
string public_udp6_endpoint = 7; // endpoint for UDP peer-to-peer communication over IPv6 (public IPv6 + port as seen from the Internet)
79+
string public_udp4_endpoint = 6 [deprecated = true]; // endpoint for UDP peer-to-peer communication over IPv4 (public IPv4 + port as seen from the Internet)
80+
string public_udp6_endpoint = 7 [deprecated = true]; // endpoint for UDP peer-to-peer communication over IPv6 (public IPv6 + port as seen from the Internet)
8081
PeerType type = 8; // client or connector
8182
repeated Service services = 9; // applicable only when PeerType == PEER_TYPE_CONNECTOR
82-
string name = 10; // device (client or connector) name
83+
string name = 10; // device (client or connector) name
84+
repeated IPAddrPort addresses = 11; // all ip address and port combinations that the peer can tx/rx traffic
8385
}
8486

8587
message Service {
@@ -103,11 +105,23 @@ message IPAddressWithMetadata {
103105
google.protobuf.Struct metadata = 3;
104106
}
105107

108+
message IPAddrPort {
109+
string ip_address = 1;
110+
IPAddressType ip_version = 2;
111+
IPAddressScope ip_scope = 3;
112+
uint32 port = 4;
113+
}
114+
106115
enum IPAddressType {
107116
IPV4 = 0;
108117
IPV6 = 1;
109118
}
110119

120+
enum IPAddressScope {
121+
IP_ADDRESS_SCOPE_PRIVATE = 0;
122+
IP_ADDRESS_SCOPE_PUBLIC = 1;
123+
}
124+
111125
enum PeerType {
112126
PEER_TYPE_UNKNOWN = 0;
113127
PEER_TYPE_DEVICE = 1;

connector/connector.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/connector_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

device/device.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

device/device_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker/go.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23-alpine3.20
1+
FROM golang:1.24-alpine3.22
22

33
RUN apk --no-cache update
44
RUN apk --no-cache upgrade

gen/kotlin/border0/common/v1/DiscoveryDetailsMessageKt.kt

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public object DiscoveryDetailsMessageKt {
5252
* the endpoint (IPv4 + port) to send packets to for the peer
5353
* </pre>
5454
*
55-
* <code>string endpoint_public_udp4 = 2;</code>
55+
* <code>string endpoint_public_udp4 = 2 [deprecated = true];</code>
5656
*/
57-
public var endpointPublicUdp4: kotlin.String
57+
@kotlin.Deprecated(message = "Field endpointPublicUdp4 is deprecated") public var endpointPublicUdp4: kotlin.String
5858
@JvmName("getEndpointPublicUdp4")
5959
get() = _builder.getEndpointPublicUdp4()
6060
@JvmName("setEndpointPublicUdp4")
@@ -66,7 +66,9 @@ public object DiscoveryDetailsMessageKt {
6666
* the endpoint (IPv4 + port) to send packets to for the peer
6767
* </pre>
6868
*
69-
* <code>string endpoint_public_udp4 = 2;</code>
69+
* <code>string endpoint_public_udp4 = 2 [deprecated = true];</code>
70+
* @deprecated border0.common.v1.DiscoveryDetailsMessage.endpoint_public_udp4 is deprecated.
71+
* See messages.proto;l=14
7072
*/
7173
public fun clearEndpointPublicUdp4() {
7274
_builder.clearEndpointPublicUdp4()
@@ -77,9 +79,9 @@ public object DiscoveryDetailsMessageKt {
7779
* the endpoint (IPv6 + port) to send packets to for the peer
7880
* </pre>
7981
*
80-
* <code>string endpoint_public_udp6 = 3;</code>
82+
* <code>string endpoint_public_udp6 = 3 [deprecated = true];</code>
8183
*/
82-
public var endpointPublicUdp6: kotlin.String
84+
@kotlin.Deprecated(message = "Field endpointPublicUdp6 is deprecated") public var endpointPublicUdp6: kotlin.String
8385
@JvmName("getEndpointPublicUdp6")
8486
get() = _builder.getEndpointPublicUdp6()
8587
@JvmName("setEndpointPublicUdp6")
@@ -91,7 +93,9 @@ public object DiscoveryDetailsMessageKt {
9193
* the endpoint (IPv6 + port) to send packets to for the peer
9294
* </pre>
9395
*
94-
* <code>string endpoint_public_udp6 = 3;</code>
96+
* <code>string endpoint_public_udp6 = 3 [deprecated = true];</code>
97+
* @deprecated border0.common.v1.DiscoveryDetailsMessage.endpoint_public_udp6 is deprecated.
98+
* See messages.proto;l=15
9599
*/
96100
public fun clearEndpointPublicUdp6() {
97101
_builder.clearEndpointPublicUdp6()
@@ -121,6 +125,106 @@ public object DiscoveryDetailsMessageKt {
121125
public fun clearPublicKey() {
122126
_builder.clearPublicKey()
123127
}
128+
129+
/**
130+
* An uninstantiable, behaviorless type to represent the field in
131+
* generics.
132+
*/
133+
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
134+
public class AddressesProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
135+
/**
136+
* <pre>
137+
* all ip address and port combinations that the peer can tx/rx traffic
138+
* </pre>
139+
*
140+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
141+
*/
142+
public val addresses: com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>
143+
@kotlin.jvm.JvmSynthetic
144+
get() = com.google.protobuf.kotlin.DslList(
145+
_builder.getAddressesList()
146+
)
147+
/**
148+
* <pre>
149+
* all ip address and port combinations that the peer can tx/rx traffic
150+
* </pre>
151+
*
152+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
153+
* @param value The addresses to add.
154+
*/
155+
@kotlin.jvm.JvmSynthetic
156+
@kotlin.jvm.JvmName("addAddresses")
157+
public fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.add(value: border0.common.v1.Messages.IPAddrPort) {
158+
_builder.addAddresses(value)
159+
}
160+
/**
161+
* <pre>
162+
* all ip address and port combinations that the peer can tx/rx traffic
163+
* </pre>
164+
*
165+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
166+
* @param value The addresses to add.
167+
*/
168+
@kotlin.jvm.JvmSynthetic
169+
@kotlin.jvm.JvmName("plusAssignAddresses")
170+
@Suppress("NOTHING_TO_INLINE")
171+
public inline operator fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.plusAssign(value: border0.common.v1.Messages.IPAddrPort) {
172+
add(value)
173+
}
174+
/**
175+
* <pre>
176+
* all ip address and port combinations that the peer can tx/rx traffic
177+
* </pre>
178+
*
179+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
180+
* @param values The addresses to add.
181+
*/
182+
@kotlin.jvm.JvmSynthetic
183+
@kotlin.jvm.JvmName("addAllAddresses")
184+
public fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.addAll(values: kotlin.collections.Iterable<border0.common.v1.Messages.IPAddrPort>) {
185+
_builder.addAllAddresses(values)
186+
}
187+
/**
188+
* <pre>
189+
* all ip address and port combinations that the peer can tx/rx traffic
190+
* </pre>
191+
*
192+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
193+
* @param values The addresses to add.
194+
*/
195+
@kotlin.jvm.JvmSynthetic
196+
@kotlin.jvm.JvmName("plusAssignAllAddresses")
197+
@Suppress("NOTHING_TO_INLINE")
198+
public inline operator fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.plusAssign(values: kotlin.collections.Iterable<border0.common.v1.Messages.IPAddrPort>) {
199+
addAll(values)
200+
}
201+
/**
202+
* <pre>
203+
* all ip address and port combinations that the peer can tx/rx traffic
204+
* </pre>
205+
*
206+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
207+
* @param index The index to set the value at.
208+
* @param value The addresses to set.
209+
*/
210+
@kotlin.jvm.JvmSynthetic
211+
@kotlin.jvm.JvmName("setAddresses")
212+
public operator fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.set(index: kotlin.Int, value: border0.common.v1.Messages.IPAddrPort) {
213+
_builder.setAddresses(index, value)
214+
}
215+
/**
216+
* <pre>
217+
* all ip address and port combinations that the peer can tx/rx traffic
218+
* </pre>
219+
*
220+
* <code>repeated .border0.common.v1.IPAddrPort addresses = 5;</code>
221+
*/
222+
@kotlin.jvm.JvmSynthetic
223+
@kotlin.jvm.JvmName("clearAddresses")
224+
public fun com.google.protobuf.kotlin.DslList<border0.common.v1.Messages.IPAddrPort, AddressesProxy>.clear() {
225+
_builder.clearAddresses()
226+
}
227+
124228
}
125229
}
126230
@kotlin.jvm.JvmSynthetic
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
//Generated by the protocol buffer compiler. DO NOT EDIT!
2+
// source: messages.proto
3+
4+
package border0.common.v1;
5+
6+
@kotlin.jvm.JvmName("-initializeiPAddrPort")
7+
public inline fun iPAddrPort(block: border0.common.v1.IPAddrPortKt.Dsl.() -> kotlin.Unit): border0.common.v1.Messages.IPAddrPort =
8+
border0.common.v1.IPAddrPortKt.Dsl._create(border0.common.v1.Messages.IPAddrPort.newBuilder()).apply { block() }._build()
9+
public object IPAddrPortKt {
10+
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
11+
@com.google.protobuf.kotlin.ProtoDslMarker
12+
public class Dsl private constructor(
13+
private val _builder: border0.common.v1.Messages.IPAddrPort.Builder
14+
) {
15+
public companion object {
16+
@kotlin.jvm.JvmSynthetic
17+
@kotlin.PublishedApi
18+
internal fun _create(builder: border0.common.v1.Messages.IPAddrPort.Builder): Dsl = Dsl(builder)
19+
}
20+
21+
@kotlin.jvm.JvmSynthetic
22+
@kotlin.PublishedApi
23+
internal fun _build(): border0.common.v1.Messages.IPAddrPort = _builder.build()
24+
25+
/**
26+
* <code>string ip_address = 1;</code>
27+
*/
28+
public var ipAddress: kotlin.String
29+
@JvmName("getIpAddress")
30+
get() = _builder.getIpAddress()
31+
@JvmName("setIpAddress")
32+
set(value) {
33+
_builder.setIpAddress(value)
34+
}
35+
/**
36+
* <code>string ip_address = 1;</code>
37+
*/
38+
public fun clearIpAddress() {
39+
_builder.clearIpAddress()
40+
}
41+
42+
/**
43+
* <code>.border0.common.v1.IPAddressType ip_version = 2;</code>
44+
*/
45+
public var ipVersion: border0.common.v1.Messages.IPAddressType
46+
@JvmName("getIpVersion")
47+
get() = _builder.getIpVersion()
48+
@JvmName("setIpVersion")
49+
set(value) {
50+
_builder.setIpVersion(value)
51+
}
52+
/**
53+
* <code>.border0.common.v1.IPAddressType ip_version = 2;</code>
54+
*/
55+
public fun clearIpVersion() {
56+
_builder.clearIpVersion()
57+
}
58+
59+
/**
60+
* <code>.border0.common.v1.IPAddressScope ip_scope = 3;</code>
61+
*/
62+
public var ipScope: border0.common.v1.Messages.IPAddressScope
63+
@JvmName("getIpScope")
64+
get() = _builder.getIpScope()
65+
@JvmName("setIpScope")
66+
set(value) {
67+
_builder.setIpScope(value)
68+
}
69+
/**
70+
* <code>.border0.common.v1.IPAddressScope ip_scope = 3;</code>
71+
*/
72+
public fun clearIpScope() {
73+
_builder.clearIpScope()
74+
}
75+
76+
/**
77+
* <code>uint32 port = 4;</code>
78+
*/
79+
public var port: kotlin.Int
80+
@JvmName("getPort")
81+
get() = _builder.getPort()
82+
@JvmName("setPort")
83+
set(value) {
84+
_builder.setPort(value)
85+
}
86+
/**
87+
* <code>uint32 port = 4;</code>
88+
*/
89+
public fun clearPort() {
90+
_builder.clearPort()
91+
}
92+
}
93+
}
94+
@kotlin.jvm.JvmSynthetic
95+
public inline fun border0.common.v1.Messages.IPAddrPort.copy(block: border0.common.v1.IPAddrPortKt.Dsl.() -> kotlin.Unit): border0.common.v1.Messages.IPAddrPort =
96+
border0.common.v1.IPAddrPortKt.Dsl._create(this.toBuilder()).apply { block() }._build()
97+

0 commit comments

Comments
 (0)