Changeset 0f6f8f9 for core/java


Ignore:
Timestamp:
Dec 11, 2018 11:32:52 AM (19 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
a63d2dc
Parents:
87c97b2
Message:

Utils: Code to simulate IPv6-only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/Addresses.java

    r87c97b2 r0f6f8f9  
    5353    /** 12 char hex lower case */
    5454    private static final Set<String> _macCache = new HashSet<String>();
     55    private static final boolean TEST_IPV6_ONLY = false;
    5556
    5657    /**
     
    252253    private static boolean shouldInclude(InetAddress ia, boolean includeSiteLocal,
    253254                                         boolean includeLoopbackAndWildcard, boolean includeIPv6) {
     255        if (TEST_IPV6_ONLY) {
     256            byte[] ip = ia.getAddress();
     257            if (ip.length == 4) {
     258                int i = ip[0] & 0xff;
     259                if (i != 127 &&
     260                    i != 192 &&
     261                    i != 10 &&
     262                    i != 0)
     263                    return false;
     264            }
     265        }
     266
    254267        return
    255268            (!ia.isLinkLocalAddress()) &&     // 169.254.x.x
Note: See TracChangeset for help on using the changeset viewer.