@@ -240,39 +240,42 @@ pub fn parse_opts(globals: &mut Globals) {
240
240
. or_else ( || globals. tls_cert_path . clone ( ) ) ;
241
241
}
242
242
243
- if let Some ( hostname) = matches. get_one :: < String > ( "hostname" ) {
244
- let mut builder =
245
- dnsstamps:: DoHBuilder :: new ( hostname. to_string ( ) , globals. path . to_string ( ) ) ;
246
- if let Some ( public_address) = matches. get_one :: < String > ( "public_address" ) {
247
- builder = builder. with_address ( public_address. to_string ( ) ) ;
248
- }
249
- if let Some ( public_port) = matches. get_one :: < String > ( "public_port" ) {
250
- let public_port = public_port. parse ( ) . expect ( "Invalid public port" ) ;
251
- builder = builder. with_port ( public_port) ;
252
- }
253
- println ! (
254
- "Test DNS stamp to reach [{}] over DoH: [{}]\n " ,
255
- hostname,
256
- builder. serialize( ) . unwrap( )
257
- ) ;
243
+ match matches. get_one :: < String > ( "hostname" ) {
244
+ Some ( hostname) => {
245
+ let mut builder =
246
+ dnsstamps:: DoHBuilder :: new ( hostname. to_string ( ) , globals. path . to_string ( ) ) ;
247
+ if let Some ( public_address) = matches. get_one :: < String > ( "public_address" ) {
248
+ builder = builder. with_address ( public_address. to_string ( ) ) ;
249
+ }
250
+ if let Some ( public_port) = matches. get_one :: < String > ( "public_port" ) {
251
+ let public_port = public_port. parse ( ) . expect ( "Invalid public port" ) ;
252
+ builder = builder. with_port ( public_port) ;
253
+ }
254
+ println ! (
255
+ "Test DNS stamp to reach [{}] over DoH: [{}]\n " ,
256
+ hostname,
257
+ builder. serialize( ) . unwrap( )
258
+ ) ;
258
259
259
- let mut builder =
260
- dnsstamps:: ODoHTargetBuilder :: new ( hostname. to_string ( ) , globals. path . to_string ( ) ) ;
261
- if let Some ( public_port) = matches. get_one :: < String > ( "public_port" ) {
262
- let public_port = public_port. parse ( ) . expect ( "Invalid public port" ) ;
263
- builder = builder. with_port ( public_port) ;
264
- }
265
- println ! (
266
- "Test DNS stamp to reach [{}] over Oblivious DoH: [{}]\n " ,
267
- hostname,
268
- builder. serialize( ) . unwrap( )
269
- ) ;
260
+ let mut builder =
261
+ dnsstamps:: ODoHTargetBuilder :: new ( hostname. to_string ( ) , globals. path . to_string ( ) ) ;
262
+ if let Some ( public_port) = matches. get_one :: < String > ( "public_port" ) {
263
+ let public_port = public_port. parse ( ) . expect ( "Invalid public port" ) ;
264
+ builder = builder. with_port ( public_port) ;
265
+ }
266
+ println ! (
267
+ "Test DNS stamp to reach [{}] over Oblivious DoH: [{}]\n " ,
268
+ hostname,
269
+ builder. serialize( ) . unwrap( )
270
+ ) ;
270
271
271
- println ! ( "Check out https://dnscrypt.info/stamps/ to compute the actual stamps.\n " )
272
- } else {
273
- println ! (
272
+ println ! ( "Check out https://dnscrypt.info/stamps/ to compute the actual stamps.\n " )
273
+ }
274
+ _ => {
275
+ println ! (
274
276
"Please provide a fully qualified hostname (-H <hostname> command-line option) to get \
275
277
test DNS stamps for your server.\n "
276
278
) ;
279
+ }
277
280
}
278
281
}
0 commit comments