Changeset 2c17fef


Ignore:
Timestamp:
Feb 28, 2018 12:26:53 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f3ec5f7
Parents:
ab182d08
Message:

Addresses: CLI improvements

File:
1 edited

Legend:

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

    rab182d08 r2c17fef  
    646646        System.out.println("External IPv4 Addresses:");
    647647        Set<String> a = getAddresses(false, false, false);
    648         for (String s : a)
    649             System.out.println(s);
     648        print(a);
    650649        System.out.println("\nExternal and Local IPv4 Addresses:");
    651650        a = getAddresses(true, false, false);
    652         for (String s : a)
    653             System.out.println(s);
     651        print(a);
    654652        System.out.println("\nAll External Addresses:");
    655653        a = getAddresses(false, false, true);
    656         for (String s : a)
    657             System.out.println(s);
     654        print(a);
    658655        System.out.println("\nAll External and Local Addresses:");
    659656        a = getAddresses(true, false, true);
    660         for (String s : a)
    661             System.out.println(s);
     657        print(a);
    662658        System.out.println("\nAll addresses:");
    663659        a = getAddresses(true, true, true);
    664         for (String s : a)
    665             System.out.println(s);
     660        print(a);
    666661        System.out.println("\nIPv6 address flags:");
    667662        for (String s : a) {
     
    693688        }
    694689        System.out.println("\nIs connected? " + isConnected() +
    695                            "\nHas IPv6?     " + isConnectedIPv6());
     690                           "\nIs conn IPv6? " + isConnectedIPv6());
     691        System.out.println("Has v6 flags? " + INET6_CACHE_ENABLED);
     692    }
     693
     694    private static void print(Set<String> a) {
     695        if (a.isEmpty()) {
     696            System.out.println("none");
     697        } else {
     698            for (String s : a) {
     699                System.out.println(s);
     700            }
     701        }
    696702    }
    697703}
Note: See TracChangeset for help on using the changeset viewer.