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
6addc7f5
Commit
6addc7f5
authored
Jul 30, 2017
by
Steven Allen
Committed by
GitHub
Jul 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #54 from Stebalien/fix/table
Fix protocol multicodecs numbers
parents
c31e9eec
1a9014db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
38 deletions
+24
-38
.travis.yml
.travis.yml
+1
-1
multiaddr_test.go
multiaddr_test.go
+4
-4
protocols.csv
protocols.csv
+0
-15
protocols.go
protocols.go
+19
-18
No files found.
.travis.yml
View file @
6addc7f5
...
...
@@ -5,7 +5,7 @@ os:
language
:
go
go
:
-
1.
7
-
1.
8
install
:
true
...
...
multiaddr_test.go
View file @
6addc7f5
...
...
@@ -157,9 +157,9 @@ func TestStringToBytes(t *testing.T) {
}
}
testString
(
"/ip4/127.0.0.1/udp/1234"
,
"047f000001
11
04d2"
)
testString
(
"/ip4/127.0.0.1/udp/1234"
,
"047f000001
9102
04d2"
)
testString
(
"/ip4/127.0.0.1/tcp/4321"
,
"047f0000010610e1"
)
testString
(
"/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321"
,
"047f000001
11
04d2047f0000010610e1"
)
testString
(
"/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321"
,
"047f000001
9102
04d2047f0000010610e1"
)
}
func
TestBytesToString
(
t
*
testing
.
T
)
{
...
...
@@ -184,9 +184,9 @@ func TestBytesToString(t *testing.T) {
}
}
testString
(
"/ip4/127.0.0.1/udp/1234"
,
"047f000001
11
04d2"
)
testString
(
"/ip4/127.0.0.1/udp/1234"
,
"047f000001
9102
04d2"
)
testString
(
"/ip4/127.0.0.1/tcp/4321"
,
"047f0000010610e1"
)
testString
(
"/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321"
,
"047f000001
11
04d2047f0000010610e1"
)
testString
(
"/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321"
,
"047f000001
9102
04d2047f0000010610e1"
)
testString
(
"/onion/aaimaq4ygg2iegci:80"
,
"bc030010c0439831b48218480050"
)
}
...
...
protocols.csv
deleted
100644 → 0
View file @
c31e9eec
code size name
4 32 ip4
6 16 tcp
17 16 udp
33 16 dccp
41 128 ip6
132 16 sctp
301 0 utp
302 0 udt
400 V unix
421 V ipfs
480 0 http
443 0 https
444 96 onion
protocols.go
View file @
6addc7f5
...
...
@@ -16,25 +16,26 @@ type Protocol struct {
Transcoder
Transcoder
}
// replicating table here to:
// 1. avoid parsing the csv
// 2. ensuring errors in the csv don't screw up code.
// 3. changing a number has to happen in two places.
// You **MUST** register your multicodecs with
// https://github.com/multiformats/multicodec before adding them here.
//
// TODO: Use a single source of truth for all multicodecs instead of
// distributing them like this...
const
(
P_IP4
=
4
P_TCP
=
6
P_UDP
=
1
7
P_DCCP
=
33
P_IP6
=
41
P_QUIC
=
81
P_SCTP
=
132
P_UT
P
=
301
P_U
D
T
=
302
P_UNIX
=
4
00
P_IPFS
=
421
P_HTTP
=
48
0
P_HTTPS
=
443
P_ONION
=
444
P_IP4
=
0x000
4
P_TCP
=
0x000
6
P_UDP
=
0x011
1
P_DCCP
=
0x0021
P_IP6
=
0x0029
P_QUIC
=
0x01CC
P_SCTP
=
0x0084
P_U
D
T
=
0x012D
P_UT
P
=
0x012E
P_UNIX
=
0
x019
0
P_IPFS
=
0x01A5
P_HTTP
=
0x01E
0
P_HTTPS
=
0x01BB
P_ONION
=
0x01BC
)
// These are special sizes
...
...
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