fn filter_addresses(ip_address: Option<NetAddress>) -> Option<NetAddress> {
match ip_address{
// For IPv4 range 10.0.0.0 - 10.255.255.255 (10/8)
fn filter_addresses(ip_address: Option<NetAddress>) -> Option<NetAddress> {
match ip_address{
// For IPv4 range 10.0.0.0 - 10.255.255.255 (10/8)
- Some(NetAddress::IPv4{addr: [0xA, 0x00..=0xFF, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [10, _, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0x0, 0x0..=0xFF, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [0, _, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0x64, 0x40..=0x7F, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [100, 64..=127, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0x7F, 0x0..=0xFF, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [127, _, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0xA9, 0xFE, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [169, 254, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0xAC, 0x10..=0x1F, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [172, 16..=31, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0xC0, 0xA8, _, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [192, 168, _, _], port: _}) => None,
- Some(NetAddress::IPv4{addr: [0xC0, 0x58, 0x63, _], port: _}) => None,
+ Some(NetAddress::IPv4{addr: [192, 88, 99, _], port: _}) => None,
// For IPv6 range 2000:0000:0000:0000:0000:0000:0000:0000 - 3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff (2000::/3)
Some(NetAddress::IPv6{addr: [0x20..=0x3F, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], port: _}) => ip_address,
// For remaining addresses
// For IPv6 range 2000:0000:0000:0000:0000:0000:0000:0000 - 3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff (2000::/3)
Some(NetAddress::IPv6{addr: [0x20..=0x3F, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], port: _}) => ip_address,
// For remaining addresses
/// Indicates a new outbound connection has been established to a node with the given node_id
/// and an optional remote network address.
/// Indicates a new outbound connection has been established to a node with the given node_id
/// and an optional remote network address.
- /// peer using the init message.
- /// The user should pass the remote network address to whatever host they are connected to.
+ /// peer using the init message.
+ /// The user should pass the remote network address of the host they are connected to.
///
/// Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
/// descriptor but must disconnect the connection immediately.
///
/// Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
/// descriptor but must disconnect the connection immediately.
/// May refuse the connection by returning an Err, but will never write bytes to the remote end
/// (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
/// call socket_disconnected for the new descriptor but must disconnect the connection
/// May refuse the connection by returning an Err, but will never write bytes to the remote end
/// (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
/// call socket_disconnected for the new descriptor but must disconnect the connection
self.enqueue_message(peer, &resp);
peer.awaiting_pong_timer_tick_intervals = 0;
},
self.enqueue_message(peer, &resp);
peer.awaiting_pong_timer_tick_intervals = 0;
},
self.enqueue_message(peer, &resp);
peer.awaiting_pong_timer_tick_intervals = 0;
},
self.enqueue_message(peer, &resp);
peer.awaiting_pong_timer_tick_intervals = 0;
},