mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-01 02:46:47 +00:00
Return Optional.empty() for present-but-not-routed IPs.
This commit is contained in:
1 parent
b89de860d3
commit
94ac3f6cc8
3 files changed
+4
-1
No files matched your search
@@ -71,7 +71,8 @@ class AsnTable {
|
||||
|
||||
return Optional.ofNullable(asnBlocksByFirstIp.floorEntry(addressAsLong))
|
||||
.filter(entry -> entry.getValue().contains(addressAsLong))
|
||||
.map(entry -> entry.getValue().getAsn());
|
||||
.map(entry -> entry.getValue().getAsn())
|
||||
.filter(asn -> asn != 0);
|
||||
}
|
||||
|
||||
public Optional<String> getCountryCode(final long asn) {
|
||||
|
||||
@@ -25,6 +25,7 @@ class AsnTableTest {
|
||||
|
||||
assertEquals(Optional.of(7922L), asnTable.getAsn((Inet4Address) Inet4Address.getByName("50.79.54.1")));
|
||||
assertEquals(Optional.of(7552L), asnTable.getAsn((Inet4Address) Inet4Address.getByName("27.79.32.1")));
|
||||
assertEquals(Optional.empty(), asnTable.getAsn((Inet4Address) Inet4Address.getByName("5.182.202.1")));
|
||||
assertEquals(Optional.empty(), asnTable.getAsn((Inet4Address) Inet4Address.getByName("32.79.117.1")));
|
||||
assertEquals(Optional.empty(), asnTable.getAsn((Inet4Address) Inet4Address.getByName("10.0.0.1")));
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
95865344 95865855 0 None Not routed
|
||||
458051584 458227711 7552 VN VIETEL-AS-AP Viettel Group
|
||||
843841536 844103679 7922 US COMCAST-7922 - Comcast Cable Communications, LLC
|
||||
|
Reference in new issue
Block a user