@@ -502,21 +502,21 @@ impl core::fmt::Display for OptionalFromDebugger<'_> {
502
502
fn filter_addresses ( ip_address : Option < NetAddress > ) -> Option < NetAddress > {
503
503
match ip_address{
504
504
// For IPv4 range 10.0.0.0 - 10.255.255.255 (10/8)
505
- Some ( NetAddress :: IPv4 { addr : [ 0xA , 0x00 ..= 0xFF , _, _] , port : _} ) => None ,
505
+ Some ( NetAddress :: IPv4 { addr : [ 10 , _ , _, _] , port : _} ) => None ,
506
506
// For IPv4 range 0.0.0.0 - 0.255.255.255 (0/8)
507
- Some ( NetAddress :: IPv4 { addr : [ 0x0 , 0x0 ..= 0xFF , _, _] , port : _} ) => None ,
507
+ Some ( NetAddress :: IPv4 { addr : [ 0 , _ , _, _] , port : _} ) => None ,
508
508
// For IPv4 range 100.64.0.0 - 100.127.255.255 (100.64/10)
509
- Some ( NetAddress :: IPv4 { addr : [ 0x64 , 0x40 ..=0x7F , _, _] , port : _} ) => None ,
509
+ Some ( NetAddress :: IPv4 { addr : [ 100 , 64 ..=127 , _, _] , port : _} ) => None ,
510
510
// For IPv4 range 127.0.0.0 - 127.255.255.255 (127/8)
511
- Some ( NetAddress :: IPv4 { addr : [ 0x7F , 0x0 ..= 0xFF , _, _] , port : _} ) => None ,
511
+ Some ( NetAddress :: IPv4 { addr : [ 127 , _ , _, _] , port : _} ) => None ,
512
512
// For IPv4 range 169.254.0.0 - 169.254.255.255 (169.254/16)
513
- Some ( NetAddress :: IPv4 { addr : [ 0xA9 , 0xFE , _, _] , port : _} ) => None ,
513
+ Some ( NetAddress :: IPv4 { addr : [ 169 , 254 , _, _] , port : _} ) => None ,
514
514
// For IPv4 range 172.16.0.0 - 172.31.255.255 (172.16/12)
515
- Some ( NetAddress :: IPv4 { addr : [ 0xAC , 0x10 ..=0x1F , _, _] , port : _} ) => None ,
515
+ Some ( NetAddress :: IPv4 { addr : [ 172 , 16 ..=31 , _, _] , port : _} ) => None ,
516
516
// For IPv4 range 192.168.0.0 - 192.168.255.255 (192.168/16)
517
- Some ( NetAddress :: IPv4 { addr : [ 0xC0 , 0xA8 , _, _] , port : _} ) => None ,
517
+ Some ( NetAddress :: IPv4 { addr : [ 192 , 168 , _, _] , port : _} ) => None ,
518
518
// For IPv4 range 192.88.99.0 - 192.88.99.255 (192.88.99/24)
519
- Some ( NetAddress :: IPv4 { addr : [ 0xC0 , 0x58 , 0x63 , _] , port : _} ) => None ,
519
+ Some ( NetAddress :: IPv4 { addr : [ 192 , 88 , 99 , _] , port : _} ) => None ,
520
520
// For IPv6 range 2000:0000:0000:0000:0000:0000:0000:0000 - 3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff (2000::/3)
521
521
Some ( NetAddress :: IPv6 { addr : [ 0x20 ..=0x3F , _, _, _, _, _, _, _, _, _, _, _, _, _, _, _] , port : _} ) => ip_address,
522
522
// For remaining addresses
@@ -576,9 +576,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
576
576
577
577
/// Indicates a new outbound connection has been established to a node with the given node_id
578
578
/// and an optional remote network address.
579
+ ///
579
580
/// The remote network address adds the option to report a remote IP address back to a connecting
580
- /// peer using the init message.
581
- /// The user should pass the remote network address to whatever host they are connected to.
581
+ /// peer using the init message.
582
+ /// The user should pass the remote network address of the host they are connected to.
582
583
///
583
584
/// Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
584
585
/// descriptor but must disconnect the connection immediately.
@@ -623,6 +624,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
623
624
/// Indicates a new inbound connection has been established to a node with an optional remote
624
625
/// network address.
625
626
///
627
+ /// The remote network address adds the option to report a remote IP address back to a connecting
628
+ /// peer using the init message.
629
+ /// The user should pass the remote network address of the host they are connected to.
630
+ ///
626
631
/// May refuse the connection by returning an Err, but will never write bytes to the remote end
627
632
/// (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
628
633
/// call socket_disconnected for the new descriptor but must disconnect the connection
@@ -903,7 +908,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
903
908
peer. their_node_id = Some ( their_node_id) ;
904
909
insert_node_id ! ( ) ;
905
910
let features = InitFeatures :: known ( ) ;
906
- let resp = msgs:: Init { features, remote_network_address : filter_addresses ( peer. their_net_address . clone ( ) ) } ;
911
+ let resp = msgs:: Init { features, remote_network_address : filter_addresses ( peer. their_net_address . clone ( ) ) } ;
907
912
self . enqueue_message ( peer, & resp) ;
908
913
peer. awaiting_pong_timer_tick_intervals = 0 ;
909
914
} ,
@@ -914,7 +919,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
914
919
peer. their_node_id = Some ( their_node_id) ;
915
920
insert_node_id ! ( ) ;
916
921
let features = InitFeatures :: known ( ) ;
917
- let resp = msgs:: Init { features, remote_network_address : filter_addresses ( peer. their_net_address . clone ( ) ) } ;
922
+ let resp = msgs:: Init { features, remote_network_address : filter_addresses ( peer. their_net_address . clone ( ) ) } ;
918
923
self . enqueue_message ( peer, & resp) ;
919
924
peer. awaiting_pong_timer_tick_intervals = 0 ;
920
925
} ,
0 commit comments