From 17f74ce70700e1321f7f19d50c68f3ab636e50be Mon Sep 17 00:00:00 2001 From: odisseus Date: Fri, 19 Jun 2020 05:34:50 +0200 Subject: [PATCH 1/2] Added support for the /p2p protocol, which is an alias for /ipfs. --- src/main/java/io/ipfs/multiaddr/Protocol.java | 2 ++ src/test/java/io/ipfs/api/MultiAddressTest.java | 1 + 2 files changed, 3 insertions(+) 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", From 1b2044f1dbdea45b33243d5f99bc5227193ff1e8 Mon Sep 17 00:00:00 2001 From: odisseus Date: Fri, 19 Jun 2020 06:10:25 +0200 Subject: [PATCH 2/2] Updated CI settings --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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