Skip to content

Commit

Permalink
换用 node 遍历
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jan 7, 2025
1 parent 39b86f5 commit 4e60c96
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,14 @@ public DualIPv4v6Tries filterIP(DualIPv4v6Tries ips) {

public <T> DualIPv4v6AssociativeTries<T> filterIP(DualIPv4v6AssociativeTries<T> ips) {
DualIPv4v6AssociativeTries<T> dualIPv4v6Tries = new DualIPv4v6AssociativeTries<>();
ips.forEach(ip -> {
ips.nodeIterator(false).forEachRemaining(node -> {
var ip = node.getKey();
if (!ip.isLocal() && !ip.isLoopback()) {
try {
if (ip.getPrefixLength() == null && ip.isIPv6()) {
ip = ip.toPrefixBlock(ipv6ConvertToPrefixLength);
}
dualIPv4v6Tries.put(ip, ips.get(ip));
dualIPv4v6Tries.put(ip, node.getValue());
} catch (Exception e) {
log.error("Unable to convert {} with prefix block {}.", ip, ipv6ConvertToPrefixLength, e);
}
Expand Down

0 comments on commit 4e60c96

Please sign in to comment.