Skip to content

Commit 025beb5

Browse files
committed
Release v1.4.10
Add webrtc, sni, quic-v1. fix certhash
1 parent 967eec7 commit 025beb5

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<attribute name="Class-Path" value="${manifest_cp}"/>
4141
<attribute name="Implementation-Vendor" value="io.ipfs"/>
4242
<attribute name="Implementation-Title" value="multiaddr"/>
43-
<attribute name="Implementation-Version" value="1.4.9"/>
43+
<attribute name="Implementation-Version" value="1.4.10"/>
4444
</manifest>
4545
</jar>
4646
</target>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.multiformats</groupId>
66
<artifactId>java-multiaddr</artifactId>
7-
<version>v1.4.9</version>
7+
<version>v1.4.10</version>
88

99
<name>multiaddr</name>
1010
<url>https://github.com/multiformats/java-multiaddr</url>

src/main/java/io/ipfs/multiaddr/Protocol.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum Type {
2525
SCTP(132, 16, "sctp"),
2626
UDP(273, 16, "udp"),
2727
P2PWEBRTC(276, 0, "p2p-webrtc-direct"),
28+
WEBRTC(280, 0, "webrtc"),
2829
UTP(301, 0, "utp"),
2930
UDT(302, 0, "udt"),
3031
UNIX(400, LENGTH_PREFIXED_VAR_SIZE, "unix"),
@@ -36,8 +37,10 @@ enum Type {
3637
GARLIC64(446, LENGTH_PREFIXED_VAR_SIZE, "garlic64"),
3738
GARLIC32(447, LENGTH_PREFIXED_VAR_SIZE, "garlic32"),
3839
TLS(448, 0, "tls"),
40+
SNI(449, LENGTH_PREFIXED_VAR_SIZE, "sni"),
3941
NOISE(454, 0, "noise"),
4042
QUIC(460, 0, "quic"),
43+
QUIC_V1(461, 0, "quic-v1"),
4144
WEBTRANSPORT(465, 0, "webtransport"),
4245
CERTHASH(466, LENGTH_PREFIXED_VAR_SIZE, "certhash"),
4346
WS(477, 0, "ws"),
@@ -138,10 +141,16 @@ public byte[] addressToBytes(String addr) {
138141
bout.write(hashBytes);
139142
return bout.toByteArray();
140143
}
141-
case CERTHASH:
144+
case CERTHASH: {
142145
byte[] raw = Multibase.decode(addr);
143146
Multihash.deserialize(raw);
144-
return raw;
147+
ByteArrayOutputStream bout = new ByteArrayOutputStream();
148+
byte[] varint = new byte[(32 - Integer.numberOfLeadingZeros(raw.length) + 6) / 7];
149+
putUvarint(varint, raw.length);
150+
bout.write(varint);
151+
bout.write(raw);
152+
return bout.toByteArray();
153+
}
145154
case ONION: {
146155
String[] split = addr.split(":");
147156
if (split.length != 2)
@@ -288,7 +297,7 @@ public String readAddress(InputStream in) throws IOException {
288297
case CERTHASH:
289298
buf = new byte[sizeForAddress];
290299
read(in, buf);
291-
return Multibase.encode(Multibase.Base.Base64, buf);
300+
return Multibase.encode(Multibase.Base.Base64Url, buf);
292301
case ONION: {
293302
byte[] host = new byte[10];
294303
read(in, host);

src/test/java/io/ipfs/api/MultiAddressTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public void succeeds() {
8787
"/ip6zone/x%y/ip6/fe80::1",
8888
"/ip6zone/x%y/ip6/::",
8989
"/ip6zone/x/ip6/fe80::1/udp/1234/quic",
90+
"/ip6/::1/udp/4001/quic-v1",
91+
"/ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiBwuhj7sQdRxdMIppgEp5kx2XTfYtSUE_8ukOpi8TRPRw/certhash/uEiD8fBEvx4OOkDOdeknjNkpiFWBOEqJYOjwsFdBJobIJNA",
9092
"/onion/timaq4ygg2iegci7:1234",
9193
"/onion/timaq4ygg2iegci7:80/http",
9294
"/onion3/vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd:1234",

0 commit comments

Comments
 (0)