testing
This commit is contained in:
parent
ee0e729a92
commit
568a308c82
@ -345,9 +345,10 @@ impl NetworkManager {
|
|||||||
// This is so we can preserve the inbound NAT mappings at our router
|
// This is so we can preserve the inbound NAT mappings at our router
|
||||||
for did in &dids {
|
for did in &dids {
|
||||||
// Do we need to do this ping?
|
// Do we need to do this ping?
|
||||||
|
// Check if we have already pinged over this low-level-protocol/address-type/port combo
|
||||||
|
// We want to ensure we do the bare minimum required here
|
||||||
let pt = did.dial_info.protocol_type();
|
let pt = did.dial_info.protocol_type();
|
||||||
let at = did.dial_info.address_type();
|
let at = did.dial_info.address_type();
|
||||||
|
|
||||||
let needs_ping = if let Some((llpt, port)) =
|
let needs_ping = if let Some((llpt, port)) =
|
||||||
mapped_port_info.protocol_to_port.get(&(pt, at))
|
mapped_port_info.protocol_to_port.get(&(pt, at))
|
||||||
{
|
{
|
||||||
|
@ -10,18 +10,18 @@ pub async fn test_add_get_remove() {
|
|||||||
let mut table = ConnectionTable::new(config);
|
let mut table = ConnectionTable::new(config);
|
||||||
|
|
||||||
let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new(
|
let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new(
|
||||||
SocketAddress::new(Address::IPV4(Ipv4Addr::new(127, 0, 0, 1)), 8080),
|
SocketAddress::new(Address::IPV4(Ipv4Addr::new(192, 168, 0, 1)), 8080),
|
||||||
ProtocolType::TCP,
|
ProtocolType::TCP,
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let a2 = a1;
|
let a2 = a1;
|
||||||
let a3 = ConnectionDescriptor::new(
|
let a3 = ConnectionDescriptor::new(
|
||||||
PeerAddress::new(
|
PeerAddress::new(
|
||||||
SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
SocketAddress::new(Address::IPV6(Ipv6Addr::new(191, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
||||||
ProtocolType::TCP,
|
ProtocolType::TCP,
|
||||||
),
|
),
|
||||||
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
||||||
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1),
|
Ipv6Addr::new(191, 0, 0, 0, 0, 0, 0, 1),
|
||||||
8080,
|
8080,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -30,11 +30,11 @@ pub async fn test_add_get_remove() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let a4 = ConnectionDescriptor::new(
|
let a4 = ConnectionDescriptor::new(
|
||||||
PeerAddress::new(
|
PeerAddress::new(
|
||||||
SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
SocketAddress::new(Address::IPV6(Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
||||||
ProtocolType::TCP,
|
ProtocolType::TCP,
|
||||||
),
|
),
|
||||||
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
||||||
Ipv6Addr::new(1, 0, 0, 0, 0, 0, 0, 1),
|
Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1),
|
||||||
8080,
|
8080,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -43,11 +43,11 @@ pub async fn test_add_get_remove() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let a5 = ConnectionDescriptor::new(
|
let a5 = ConnectionDescriptor::new(
|
||||||
PeerAddress::new(
|
PeerAddress::new(
|
||||||
SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
SocketAddress::new(Address::IPV6(Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1)), 8090),
|
||||||
ProtocolType::WSS,
|
ProtocolType::WSS,
|
||||||
),
|
),
|
||||||
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new(
|
||||||
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1),
|
Ipv6Addr::new(193, 0, 0, 0, 0, 0, 0, 1),
|
||||||
8080,
|
8080,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -93,7 +93,7 @@ core:
|
|||||||
set_value_timeout:
|
set_value_timeout:
|
||||||
set_value_count: 20
|
set_value_count: 20
|
||||||
set_value_fanout: 5
|
set_value_fanout: 5
|
||||||
min_peer_count: 2 # 20
|
min_peer_count: 20
|
||||||
min_peer_refresh_time_ms: 2000
|
min_peer_refresh_time_ms: 2000
|
||||||
validate_dial_info_receipt_time_ms: 2000
|
validate_dial_info_receipt_time_ms: 2000
|
||||||
upnp: false
|
upnp: false
|
||||||
@ -1457,10 +1457,10 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(s.core.network.connection_initial_timeout_ms, 2_000u32);
|
assert_eq!(s.core.network.connection_initial_timeout_ms, 2_000u32);
|
||||||
assert_eq!(s.core.network.connection_inactivity_timeout_ms, 60_000u32);
|
assert_eq!(s.core.network.connection_inactivity_timeout_ms, 60_000u32);
|
||||||
assert_eq!(s.core.network.max_connections_per_ip4, 8u32);
|
assert_eq!(s.core.network.max_connections_per_ip4, 32u32);
|
||||||
assert_eq!(s.core.network.max_connections_per_ip6_prefix, 8u32);
|
assert_eq!(s.core.network.max_connections_per_ip6_prefix, 32u32);
|
||||||
assert_eq!(s.core.network.max_connections_per_ip6_prefix_size, 56u32);
|
assert_eq!(s.core.network.max_connections_per_ip6_prefix_size, 56u32);
|
||||||
assert_eq!(s.core.network.max_connection_frequency_per_min, 8u32);
|
assert_eq!(s.core.network.max_connection_frequency_per_min, 128u32);
|
||||||
assert_eq!(s.core.network.client_whitelist_timeout_ms, 300_000u32);
|
assert_eq!(s.core.network.client_whitelist_timeout_ms, 300_000u32);
|
||||||
assert_eq!(s.core.network.reverse_connection_receipt_time_ms, 5_000u32);
|
assert_eq!(s.core.network.reverse_connection_receipt_time_ms, 5_000u32);
|
||||||
assert_eq!(s.core.network.hole_punch_receipt_time_ms, 5_000u32);
|
assert_eq!(s.core.network.hole_punch_receipt_time_ms, 5_000u32);
|
||||||
|
Loading…
Reference in New Issue
Block a user