Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
5961756b
Commit
5961756b
authored
Nov 11, 2022
by
Marco Munizaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add quic-v1
parent
930206d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
multiaddr_test.go
multiaddr_test.go
+14
-7
protocols.go
protocols.go
+7
-0
No files found.
multiaddr_test.go
View file @
5961756b
...
@@ -39,6 +39,7 @@ func TestConstructFails(t *testing.T) {
...
@@ -39,6 +39,7 @@ func TestConstructFails(t *testing.T) {
"/udp/65536"
,
"/udp/65536"
,
"/tcp/65536"
,
"/tcp/65536"
,
"/quic/65536"
,
"/quic/65536"
,
"/quic-v1/65536"
,
"/onion/9imaq4ygg2iegci7:80"
,
"/onion/9imaq4ygg2iegci7:80"
,
"/onion/aaimaq4ygg2iegci7:80"
,
"/onion/aaimaq4ygg2iegci7:80"
,
"/onion/timaq4ygg2iegci7:0"
,
"/onion/timaq4ygg2iegci7:0"
,
...
@@ -74,8 +75,9 @@ func TestConstructFails(t *testing.T) {
...
@@ -74,8 +75,9 @@ func TestConstructFails(t *testing.T) {
"/ip4/127.0.0.1/tcp/jfodsajfidosajfoidsa"
,
"/ip4/127.0.0.1/tcp/jfodsajfidosajfoidsa"
,
"/ip4/127.0.0.1/tcp"
,
"/ip4/127.0.0.1/tcp"
,
"/ip4/127.0.0.1/quic/1234"
,
"/ip4/127.0.0.1/quic/1234"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport/certhash"
,
"/ip4/127.0.0.1/quic-v1/1234"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmp"
,
// 1 character missing from certhash
"/ip4/127.0.0.1/udp/1234/quic-v1/webtransport/certhash"
,
"/ip4/127.0.0.1/udp/1234/quic-v1/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmp"
,
// 1 character missing from certhash
"/ip4/127.0.0.1/ipfs"
,
"/ip4/127.0.0.1/ipfs"
,
"/ip4/127.0.0.1/ipfs/tcp"
,
"/ip4/127.0.0.1/ipfs/tcp"
,
"/ip4/127.0.0.1/p2p"
,
"/ip4/127.0.0.1/p2p"
,
...
@@ -109,11 +111,13 @@ func TestConstructSucceeds(t *testing.T) {
...
@@ -109,11 +111,13 @@ func TestConstructSucceeds(t *testing.T) {
"/ip6/::1"
,
"/ip6/::1"
,
"/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21"
,
"/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21"
,
"/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21/udp/1234/quic"
,
"/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21/udp/1234/quic"
,
"/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21/udp/1234/quic-v1"
,
"/ip6/2001:db8::/ipcidr/32"
,
"/ip6/2001:db8::/ipcidr/32"
,
"/ip6zone/x/ip6/fe80::1"
,
"/ip6zone/x/ip6/fe80::1"
,
"/ip6zone/x%y/ip6/fe80::1"
,
"/ip6zone/x%y/ip6/fe80::1"
,
"/ip6zone/x%y/ip6/::"
,
"/ip6zone/x%y/ip6/::"
,
"/ip6zone/x/ip6/fe80::1/udp/1234/quic"
,
"/ip6zone/x/ip6/fe80::1/udp/1234/quic"
,
"/ip6zone/x/ip6/fe80::1/udp/1234/quic-v1"
,
"/onion/timaq4ygg2iegci7:1234"
,
"/onion/timaq4ygg2iegci7:1234"
,
"/onion/timaq4ygg2iegci7:80/http"
,
"/onion/timaq4ygg2iegci7:80/http"
,
"/onion3/vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd:1234"
,
"/onion3/vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd:1234"
,
...
@@ -159,9 +163,10 @@ func TestConstructSucceeds(t *testing.T) {
...
@@ -159,9 +163,10 @@ func TestConstructSucceeds(t *testing.T) {
"/ip4/127.0.0.1/tcp/1234"
,
"/ip4/127.0.0.1/tcp/1234"
,
"/ip4/127.0.0.1/tcp/1234/"
,
"/ip4/127.0.0.1/tcp/1234/"
,
"/ip4/127.0.0.1/udp/1234/quic"
,
"/ip4/127.0.0.1/udp/1234/quic"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport"
,
"/ip4/127.0.0.1/udp/1234/quic-v1"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmpy"
,
"/ip4/127.0.0.1/udp/1234/quic-v1/webtransport"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmpy/certhash/zQmbWTwYGcmdyK9CYfNBcfs9nhZs17a6FQ4Y8oea278xx41"
,
"/ip4/127.0.0.1/udp/1234/quic-v1/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmpy"
,
"/ip4/127.0.0.1/udp/1234/quic-v1/webtransport/certhash/b2uaraocy6yrdblb4sfptaddgimjmmpy/certhash/zQmbWTwYGcmdyK9CYfNBcfs9nhZs17a6FQ4Y8oea278xx41"
,
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC"
,
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC"
,
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234"
,
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234"
,
"/ip4/127.0.0.1/ipfs/k2k4r8oqamigqdo6o7hsbfwd45y70oyynp98usk7zmyfrzpqxh1pohl7"
,
"/ip4/127.0.0.1/ipfs/k2k4r8oqamigqdo6o7hsbfwd45y70oyynp98usk7zmyfrzpqxh1pohl7"
,
...
@@ -566,7 +571,7 @@ func TestRoundTrip(t *testing.T) {
...
@@ -566,7 +571,7 @@ func TestRoundTrip(t *testing.T) {
"/ip4/127.0.0.1/tcp/123/tls"
,
"/ip4/127.0.0.1/tcp/123/tls"
,
"/ip4/127.0.0.1/udp/123"
,
"/ip4/127.0.0.1/udp/123"
,
"/ip4/127.0.0.1/udp/123/ip6/::"
,
"/ip4/127.0.0.1/udp/123/ip6/::"
,
"/ip4/127.0.0.1/udp/1234/quic/webtransport/certhash/uEiDDq4_xNyDorZBH3TlGazyJdOWSwvo4PUo5YHFMrvDE8g"
,
"/ip4/127.0.0.1/udp/1234/quic
-v1
/webtransport/certhash/uEiDDq4_xNyDorZBH3TlGazyJdOWSwvo4PUo5YHFMrvDE8g"
,
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
,
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP"
,
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c"
,
"/p2p/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP/unix/a/b/c"
,
}
{
}
{
...
@@ -796,11 +801,13 @@ func TestContains(t *testing.T) {
...
@@ -796,11 +801,13 @@ func TestContains(t *testing.T) {
a1
:=
newMultiaddr
(
t
,
"/ip4/127.0.0.1/tcp/1234"
)
a1
:=
newMultiaddr
(
t
,
"/ip4/127.0.0.1/tcp/1234"
)
a2
:=
newMultiaddr
(
t
,
"/ip4/1.1.1.1/tcp/999"
)
a2
:=
newMultiaddr
(
t
,
"/ip4/1.1.1.1/tcp/999"
)
a3
:=
newMultiaddr
(
t
,
"/ip4/1.2.3.4/udp/443/quic"
)
a3
:=
newMultiaddr
(
t
,
"/ip4/1.2.3.4/udp/443/quic"
)
addrs
:=
[]
Multiaddr
{
a1
,
a2
,
a3
}
a4
:=
newMultiaddr
(
t
,
"/ip4/1.2.3.4/udp/443/quic-v1"
)
addrs
:=
[]
Multiaddr
{
a1
,
a2
,
a3
,
a4
}
require
.
True
(
t
,
Contains
(
addrs
,
a1
))
require
.
True
(
t
,
Contains
(
addrs
,
a1
))
require
.
True
(
t
,
Contains
(
addrs
,
a2
))
require
.
True
(
t
,
Contains
(
addrs
,
a2
))
require
.
True
(
t
,
Contains
(
addrs
,
a3
))
require
.
True
(
t
,
Contains
(
addrs
,
a3
))
require
.
True
(
t
,
Contains
(
addrs
,
a4
))
require
.
False
(
t
,
Contains
(
addrs
,
newMultiaddr
(
t
,
"/ip4/4.3.2.1/udp/1234/utp"
)))
require
.
False
(
t
,
Contains
(
addrs
,
newMultiaddr
(
t
,
"/ip4/4.3.2.1/udp/1234/utp"
)))
require
.
False
(
t
,
Contains
(
nil
,
a1
))
require
.
False
(
t
,
Contains
(
nil
,
a1
))
}
}
protocols.go
View file @
5961756b
...
@@ -15,6 +15,7 @@ const (
...
@@ -15,6 +15,7 @@ const (
P_IP6ZONE
=
42
P_IP6ZONE
=
42
P_IPCIDR
=
43
P_IPCIDR
=
43
P_QUIC
=
460
P_QUIC
=
460
P_QUIC_V1
=
461
P_WEBTRANSPORT
=
465
P_WEBTRANSPORT
=
465
P_CERTHASH
=
466
P_CERTHASH
=
466
P_SCTP
=
132
P_SCTP
=
132
...
@@ -182,6 +183,11 @@ var (
...
@@ -182,6 +183,11 @@ var (
Code
:
P_QUIC
,
Code
:
P_QUIC
,
VCode
:
CodeToVarint
(
P_QUIC
),
VCode
:
CodeToVarint
(
P_QUIC
),
}
}
protoQUICV1
=
Protocol
{
Name
:
"quic-v1"
,
Code
:
P_QUIC_V1
,
VCode
:
CodeToVarint
(
P_QUIC_V1
),
}
protoWEBTRANSPORT
=
Protocol
{
protoWEBTRANSPORT
=
Protocol
{
Name
:
"webtransport"
,
Name
:
"webtransport"
,
Code
:
P_WEBTRANSPORT
,
Code
:
P_WEBTRANSPORT
,
...
@@ -285,6 +291,7 @@ func init() {
...
@@ -285,6 +291,7 @@ func init() {
protoUTP
,
protoUTP
,
protoUDT
,
protoUDT
,
protoQUIC
,
protoQUIC
,
protoQUICV1
,
protoWEBTRANSPORT
,
protoWEBTRANSPORT
,
protoCERTHASH
,
protoCERTHASH
,
protoHTTP
,
protoHTTP
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment