@@ -13,7 +13,7 @@ use std::{
13
13
14
14
use anyhow:: { anyhow, Result } ;
15
15
use clap:: Parser ;
16
- use proto:: crypto:: rustls:: QuicClientConfig ;
16
+ use proto:: { crypto:: rustls:: QuicClientConfig , TransportConfig } ;
17
17
use rustls:: pki_types:: CertificateDer ;
18
18
use tracing:: { error, info} ;
19
19
use url:: Url ;
@@ -101,8 +101,13 @@ async fn run(options: Opt) -> Result<()> {
101
101
client_crypto. key_log = Arc :: new ( rustls:: KeyLogFile :: new ( ) ) ;
102
102
}
103
103
104
- let client_config =
104
+ let mut transport = TransportConfig :: default ( ) ;
105
+ transport
106
+ . send_observed_address_reports ( true )
107
+ . receive_observed_address_reports ( true ) ;
108
+ let mut client_config =
105
109
quinn:: ClientConfig :: new ( Arc :: new ( QuicClientConfig :: try_from ( client_crypto) ?) ) ;
110
+ client_config. transport_config ( Arc :: new ( transport) ) ;
106
111
let mut endpoint = quinn:: Endpoint :: client ( options. bind ) ?;
107
112
endpoint. set_default_client_config ( client_config) ;
108
113
@@ -117,6 +122,18 @@ async fn run(options: Opt) -> Result<()> {
117
122
. await
118
123
. map_err ( |e| anyhow ! ( "failed to connect: {}" , e) ) ?;
119
124
eprintln ! ( "connected at {:?}" , start. elapsed( ) ) ;
125
+ let mut external_addresses = conn. observed_external_addr ( ) ;
126
+ tokio:: spawn ( async move {
127
+ loop {
128
+ if let Some ( new_addr) = * external_addresses. borrow_and_update ( ) {
129
+ info ! ( %new_addr, "new external address report" ) ;
130
+ }
131
+ if external_addresses. changed ( ) . await . is_err ( ) {
132
+ break ;
133
+ }
134
+ }
135
+ } ) ;
136
+
120
137
let ( mut send, mut recv) = conn
121
138
. open_bi ( )
122
139
. await
0 commit comments