@@ -58,18 +58,24 @@ pub struct Config {
58
58
/// that no discovery address has been set in the CLI args.
59
59
pub enr_address : ( Option < Ipv4Addr > , Option < Ipv6Addr > ) ,
60
60
61
- /// The udp4 port to broadcast to peers in order to reach back for discovery.
61
+ /// The udp ipv4 port to broadcast to peers in order to reach back for discovery.
62
62
pub enr_udp4_port : Option < u16 > ,
63
63
64
- /// The tcp4 port to broadcast to peers in order to reach back for libp2p services.
64
+ /// The quic ipv4 port to broadcast to peers in order to reach back for libp2p services.
65
+ pub enr_quic4_port : Option < u16 > ,
66
+
67
+ /// The tcp ipv4 port to broadcast to peers in order to reach back for libp2p services.
65
68
pub enr_tcp4_port : Option < u16 > ,
66
69
67
- /// The udp6 port to broadcast to peers in order to reach back for discovery.
70
+ /// The udp ipv6 port to broadcast to peers in order to reach back for discovery.
68
71
pub enr_udp6_port : Option < u16 > ,
69
72
70
- /// The tcp6 port to broadcast to peers in order to reach back for libp2p services.
73
+ /// The tcp ipv6 port to broadcast to peers in order to reach back for libp2p services.
71
74
pub enr_tcp6_port : Option < u16 > ,
72
75
76
+ /// The quic ipv6 port to broadcast to peers in order to reach back for libp2p services.
77
+ pub enr_quic6_port : Option < u16 > ,
78
+
73
79
/// Target number of connected peers.
74
80
pub target_peers : usize ,
75
81
@@ -102,6 +108,9 @@ pub struct Config {
102
108
/// Disables the discovery protocol from starting.
103
109
pub disable_discovery : bool ,
104
110
111
+ /// Disables quic support.
112
+ pub disable_quic_support : bool ,
113
+
105
114
/// Attempt to construct external port mappings with UPnP.
106
115
pub upnp_enabled : bool ,
107
116
@@ -149,57 +158,76 @@ impl Config {
149
158
/// Sets the listening address to use an ipv4 address. The discv5 ip_mode and table filter are
150
159
/// adjusted accordingly to ensure addresses that are present in the enr are globally
151
160
/// reachable.
152
- pub fn set_ipv4_listening_address ( & mut self , addr : Ipv4Addr , tcp_port : u16 , udp_port : u16 ) {
161
+ pub fn set_ipv4_listening_address (
162
+ & mut self ,
163
+ addr : Ipv4Addr ,
164
+ tcp_port : u16 ,
165
+ disc_port : u16 ,
166
+ quic_port : u16 ,
167
+ ) {
153
168
self . listen_addresses = ListenAddress :: V4 ( ListenAddr {
154
169
addr,
155
- udp_port,
170
+ disc_port,
171
+ quic_port,
156
172
tcp_port,
157
173
} ) ;
158
- self . discv5_config . listen_config = discv5:: ListenConfig :: from_ip ( addr. into ( ) , udp_port ) ;
174
+ self . discv5_config . listen_config = discv5:: ListenConfig :: from_ip ( addr. into ( ) , disc_port ) ;
159
175
self . discv5_config . table_filter = |enr| enr. ip4 ( ) . as_ref ( ) . map_or ( false , is_global_ipv4)
160
176
}
161
177
162
178
/// Sets the listening address to use an ipv6 address. The discv5 ip_mode and table filter is
163
179
/// adjusted accordingly to ensure addresses that are present in the enr are globally
164
180
/// reachable.
165
- pub fn set_ipv6_listening_address ( & mut self , addr : Ipv6Addr , tcp_port : u16 , udp_port : u16 ) {
181
+ pub fn set_ipv6_listening_address (
182
+ & mut self ,
183
+ addr : Ipv6Addr ,
184
+ tcp_port : u16 ,
185
+ disc_port : u16 ,
186
+ quic_port : u16 ,
187
+ ) {
166
188
self . listen_addresses = ListenAddress :: V6 ( ListenAddr {
167
189
addr,
168
- udp_port,
190
+ disc_port,
191
+ quic_port,
169
192
tcp_port,
170
193
} ) ;
171
194
172
- self . discv5_config . listen_config = discv5:: ListenConfig :: from_ip ( addr. into ( ) , udp_port ) ;
195
+ self . discv5_config . listen_config = discv5:: ListenConfig :: from_ip ( addr. into ( ) , disc_port ) ;
173
196
self . discv5_config . table_filter = |enr| enr. ip6 ( ) . as_ref ( ) . map_or ( false , is_global_ipv6)
174
197
}
175
198
176
199
/// Sets the listening address to use both an ipv4 and ipv6 address. The discv5 ip_mode and
177
200
/// table filter is adjusted accordingly to ensure addresses that are present in the enr are
178
201
/// globally reachable.
202
+ #[ allow( clippy:: too_many_arguments) ]
179
203
pub fn set_ipv4_ipv6_listening_addresses (
180
204
& mut self ,
181
205
v4_addr : Ipv4Addr ,
182
206
tcp4_port : u16 ,
183
- udp4_port : u16 ,
207
+ disc4_port : u16 ,
208
+ quic4_port : u16 ,
184
209
v6_addr : Ipv6Addr ,
185
210
tcp6_port : u16 ,
186
- udp6_port : u16 ,
211
+ disc6_port : u16 ,
212
+ quic6_port : u16 ,
187
213
) {
188
214
self . listen_addresses = ListenAddress :: DualStack (
189
215
ListenAddr {
190
216
addr : v4_addr,
191
- udp_port : udp4_port,
217
+ disc_port : disc4_port,
218
+ quic_port : quic4_port,
192
219
tcp_port : tcp4_port,
193
220
} ,
194
221
ListenAddr {
195
222
addr : v6_addr,
196
- udp_port : udp6_port,
223
+ disc_port : disc6_port,
224
+ quic_port : quic6_port,
197
225
tcp_port : tcp6_port,
198
226
} ,
199
227
) ;
200
228
self . discv5_config . listen_config = discv5:: ListenConfig :: default ( )
201
- . with_ipv4 ( v4_addr, udp4_port )
202
- . with_ipv6 ( v6_addr, udp6_port ) ;
229
+ . with_ipv4 ( v4_addr, disc4_port )
230
+ . with_ipv6 ( v6_addr, disc6_port ) ;
203
231
204
232
self . discv5_config . table_filter = |enr| match ( & enr. ip4 ( ) , & enr. ip6 ( ) ) {
205
233
( None , None ) => false ,
@@ -213,27 +241,32 @@ impl Config {
213
241
match listen_addr {
214
242
ListenAddress :: V4 ( ListenAddr {
215
243
addr,
216
- udp_port,
244
+ disc_port,
245
+ quic_port,
217
246
tcp_port,
218
- } ) => self . set_ipv4_listening_address ( addr, tcp_port, udp_port ) ,
247
+ } ) => self . set_ipv4_listening_address ( addr, tcp_port, disc_port , quic_port ) ,
219
248
ListenAddress :: V6 ( ListenAddr {
220
249
addr,
221
- udp_port,
250
+ disc_port,
251
+ quic_port,
222
252
tcp_port,
223
- } ) => self . set_ipv6_listening_address ( addr, tcp_port, udp_port ) ,
253
+ } ) => self . set_ipv6_listening_address ( addr, tcp_port, disc_port , quic_port ) ,
224
254
ListenAddress :: DualStack (
225
255
ListenAddr {
226
256
addr : ip4addr,
227
- udp_port : udp4_port,
257
+ disc_port : disc4_port,
258
+ quic_port : quic4_port,
228
259
tcp_port : tcp4_port,
229
260
} ,
230
261
ListenAddr {
231
262
addr : ip6addr,
232
- udp_port : udp6_port,
263
+ disc_port : disc6_port,
264
+ quic_port : quic6_port,
233
265
tcp_port : tcp6_port,
234
266
} ,
235
267
) => self . set_ipv4_ipv6_listening_addresses (
236
- ip4addr, tcp4_port, udp4_port, ip6addr, tcp6_port, udp6_port,
268
+ ip4addr, tcp4_port, disc4_port, quic4_port, ip6addr, tcp6_port, disc6_port,
269
+ quic6_port,
237
270
) ,
238
271
}
239
272
}
@@ -272,7 +305,8 @@ impl Default for Config {
272
305
) ;
273
306
let listen_addresses = ListenAddress :: V4 ( ListenAddr {
274
307
addr : Ipv4Addr :: UNSPECIFIED ,
275
- udp_port : 9000 ,
308
+ disc_port : 9000 ,
309
+ quic_port : 9001 ,
276
310
tcp_port : 9000 ,
277
311
} ) ;
278
312
@@ -305,10 +339,11 @@ impl Default for Config {
305
339
network_dir,
306
340
listen_addresses,
307
341
enr_address : ( None , None ) ,
308
-
309
342
enr_udp4_port : None ,
343
+ enr_quic4_port : None ,
310
344
enr_tcp4_port : None ,
311
345
enr_udp6_port : None ,
346
+ enr_quic6_port : None ,
312
347
enr_tcp6_port : None ,
313
348
target_peers : 50 ,
314
349
gs_config,
@@ -320,6 +355,7 @@ impl Default for Config {
320
355
disable_peer_scoring : false ,
321
356
client_version : lighthouse_version:: version_with_platform ( ) ,
322
357
disable_discovery : false ,
358
+ disable_quic_support : false ,
323
359
upnp_enabled : true ,
324
360
network_load : 3 ,
325
361
private : false ,
0 commit comments