@@ -1740,6 +1740,28 @@ impl Handle {
1740
1740
let inner2 = inner. clone ( ) ;
1741
1741
let network_monitor = netmon:: Monitor :: new ( ) . await ?;
1742
1742
let qad_endpoint = endpoint. clone ( ) ;
1743
+
1744
+ // create a client config for the endpoint to use for QUIC address discovery
1745
+ let root_store =
1746
+ rustls:: RootCertStore :: from_iter ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) ) ;
1747
+ let client_config = rustls:: client:: ClientConfig :: builder_with_provider ( Arc :: new (
1748
+ rustls:: crypto:: ring:: default_provider ( ) ,
1749
+ ) )
1750
+ . with_safe_default_protocol_versions ( )
1751
+ . expect ( "ring supports these" )
1752
+ . with_root_certificates ( root_store)
1753
+ . with_no_client_auth ( ) ;
1754
+ let quic_config = Some ( QuicConfig {
1755
+ ep : qad_endpoint,
1756
+ client_config,
1757
+ ipv4 : true ,
1758
+ ipv6 : pconn6_sock. is_some ( ) ,
1759
+ } ) ;
1760
+ let net_report_config = net_report:: Options :: default ( )
1761
+ . stun_v4 ( Some ( pconn4_sock. clone ( ) ) )
1762
+ . stun_v6 ( pconn6_sock. clone ( ) )
1763
+ . quic_config ( quic_config) ;
1764
+
1743
1765
actor_tasks. spawn (
1744
1766
async move {
1745
1767
let actor = Actor {
@@ -1756,7 +1778,7 @@ impl Handle {
1756
1778
no_v4_send : false ,
1757
1779
net_reporter,
1758
1780
network_monitor,
1759
- qad_endpoint ,
1781
+ net_report_config ,
1760
1782
} ;
1761
1783
1762
1784
if let Err ( err) = actor. run ( ) . await {
@@ -2172,6 +2194,9 @@ struct Actor {
2172
2194
pconn4 : Arc < UdpSocket > ,
2173
2195
pconn6 : Option < Arc < UdpSocket > > ,
2174
2196
2197
+ /// Configuration for net report
2198
+ net_report_config : net_report:: Options ,
2199
+
2175
2200
/// The NAT-PMP/PCP/UPnP prober/client, for requesting port mappings from NAT devices.
2176
2201
port_mapper : portmapper:: Client ,
2177
2202
@@ -2184,11 +2209,6 @@ struct Actor {
2184
2209
net_reporter : net_report:: Client ,
2185
2210
2186
2211
network_monitor : netmon:: Monitor ,
2187
-
2188
- /// The internal quinn::Endpoint
2189
- ///
2190
- /// Needed for Quic Address Discovery
2191
- qad_endpoint : quinn:: Endpoint ,
2192
2212
}
2193
2213
2194
2214
impl Actor {
@@ -2602,27 +2622,7 @@ impl Actor {
2602
2622
}
2603
2623
2604
2624
let relay_map = self . msock . relay_map . clone ( ) ;
2605
- let mut opts = net_report:: Options :: default ( )
2606
- . stun_v4 ( Some ( self . pconn4 . clone ( ) ) )
2607
- . stun_v6 ( self . pconn6 . clone ( ) ) ;
2608
-
2609
- // create a client config for the endpoint to use for QUIC address discovery
2610
- let root_store =
2611
- rustls:: RootCertStore :: from_iter ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) ) ;
2612
- let client_config = rustls:: client:: ClientConfig :: builder_with_provider ( Arc :: new (
2613
- rustls:: crypto:: ring:: default_provider ( ) ,
2614
- ) )
2615
- . with_safe_default_protocol_versions ( )
2616
- . expect ( "ring supports these" )
2617
- . with_root_certificates ( root_store)
2618
- . with_no_client_auth ( ) ;
2619
- let quic_config = Some ( QuicConfig {
2620
- ep : self . qad_endpoint . clone ( ) ,
2621
- client_config,
2622
- ipv4 : true ,
2623
- ipv6 : self . pconn6 . is_some ( ) ,
2624
- } ) ;
2625
- opts = opts. quic_config ( quic_config) ;
2625
+ let opts = self . net_report_config . clone ( ) ;
2626
2626
2627
2627
debug ! ( "requesting net_report report" ) ;
2628
2628
match self . net_reporter . get_report_channel ( relay_map, opts) . await {
0 commit comments