diff --git a/.travis.yml b/.travis.yml index 9bcf999..3340671 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ language: java jdk: - - oraclejdk8 + - openjdk9 + - openjdk10 + - openjdk11 diff --git a/src/main/java/io/ipfs/multiaddr/Protocol.java b/src/main/java/io/ipfs/multiaddr/Protocol.java index 496772c..e5a3cb6 100644 --- a/src/main/java/io/ipfs/multiaddr/Protocol.java +++ b/src/main/java/io/ipfs/multiaddr/Protocol.java @@ -23,6 +23,7 @@ enum Type { UTP(301, 0, "utp"), UDT(302, 0, "udt"), UNIX(400, LENGTH_PREFIXED_VAR_SIZE, "unix"), + P2P(421, LENGTH_PREFIXED_VAR_SIZE, "p2p"), IPFS(421, LENGTH_PREFIXED_VAR_SIZE, "ipfs"), HTTPS(443, 0, "https"), ONION(444, 80, "onion"), @@ -97,6 +98,7 @@ public byte[] addressToBytes(String addr) { if (x > 65535) throw new IllegalStateException("Failed to parse "+type.name+" address "+addr + " (> 65535"); return new byte[]{(byte)(x >>8), (byte)x}; + case P2P: case IPFS: { Multihash hash = Cid.decode(addr); ByteArrayOutputStream bout = new ByteArrayOutputStream(); diff --git a/src/test/java/io/ipfs/api/MultiAddressTest.java b/src/test/java/io/ipfs/api/MultiAddressTest.java index 92ba081..779400e 100644 --- a/src/test/java/io/ipfs/api/MultiAddressTest.java +++ b/src/test/java/io/ipfs/api/MultiAddressTest.java @@ -81,6 +81,7 @@ public void succeeds() { "/tcp/1234/https", "/tcp/1234/ws", "/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234", + "/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234", "/ip4/127.0.0.1/udp/1234", "/ip4/127.0.0.1/udp/0", "/ip4/127.0.0.1/tcp/1234",