mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-04 05:53:05 +00:00
Merge pull request #54 from Stebalien/fix/table
Fix protocol multicodecs numbers
This commit is contained in:
commit
6addc7f583
@ -5,7 +5,7 @@ os:
|
|||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.7
|
- 1.8
|
||||||
|
|
||||||
install: true
|
install: true
|
||||||
|
|
||||||
|
|||||||
@ -157,9 +157,9 @@ func TestStringToBytes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testString("/ip4/127.0.0.1/udp/1234", "047f0000011104d2")
|
testString("/ip4/127.0.0.1/udp/1234", "047f000001910204d2")
|
||||||
testString("/ip4/127.0.0.1/tcp/4321", "047f0000010610e1")
|
testString("/ip4/127.0.0.1/tcp/4321", "047f0000010610e1")
|
||||||
testString("/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321", "047f0000011104d2047f0000010610e1")
|
testString("/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321", "047f000001910204d2047f0000010610e1")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBytesToString(t *testing.T) {
|
func TestBytesToString(t *testing.T) {
|
||||||
@ -184,9 +184,9 @@ func TestBytesToString(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testString("/ip4/127.0.0.1/udp/1234", "047f0000011104d2")
|
testString("/ip4/127.0.0.1/udp/1234", "047f000001910204d2")
|
||||||
testString("/ip4/127.0.0.1/tcp/4321", "047f0000010610e1")
|
testString("/ip4/127.0.0.1/tcp/4321", "047f0000010610e1")
|
||||||
testString("/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321", "047f0000011104d2047f0000010610e1")
|
testString("/ip4/127.0.0.1/udp/1234/ip4/127.0.0.1/tcp/4321", "047f000001910204d2047f0000010610e1")
|
||||||
testString("/onion/aaimaq4ygg2iegci:80", "bc030010c0439831b48218480050")
|
testString("/onion/aaimaq4ygg2iegci:80", "bc030010c0439831b48218480050")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
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
|
|
||||||
|
Can't render this file because it has a wrong number of fields in line 11.
|
37
protocols.go
37
protocols.go
@ -16,25 +16,26 @@ type Protocol struct {
|
|||||||
Transcoder Transcoder
|
Transcoder Transcoder
|
||||||
}
|
}
|
||||||
|
|
||||||
// replicating table here to:
|
// You **MUST** register your multicodecs with
|
||||||
// 1. avoid parsing the csv
|
// https://github.com/multiformats/multicodec before adding them here.
|
||||||
// 2. ensuring errors in the csv don't screw up code.
|
//
|
||||||
// 3. changing a number has to happen in two places.
|
// TODO: Use a single source of truth for all multicodecs instead of
|
||||||
|
// distributing them like this...
|
||||||
const (
|
const (
|
||||||
P_IP4 = 4
|
P_IP4 = 0x0004
|
||||||
P_TCP = 6
|
P_TCP = 0x0006
|
||||||
P_UDP = 17
|
P_UDP = 0x0111
|
||||||
P_DCCP = 33
|
P_DCCP = 0x0021
|
||||||
P_IP6 = 41
|
P_IP6 = 0x0029
|
||||||
P_QUIC = 81
|
P_QUIC = 0x01CC
|
||||||
P_SCTP = 132
|
P_SCTP = 0x0084
|
||||||
P_UTP = 301
|
P_UDT = 0x012D
|
||||||
P_UDT = 302
|
P_UTP = 0x012E
|
||||||
P_UNIX = 400
|
P_UNIX = 0x0190
|
||||||
P_IPFS = 421
|
P_IPFS = 0x01A5
|
||||||
P_HTTP = 480
|
P_HTTP = 0x01E0
|
||||||
P_HTTPS = 443
|
P_HTTPS = 0x01BB
|
||||||
P_ONION = 444
|
P_ONION = 0x01BC
|
||||||
)
|
)
|
||||||
|
|
||||||
// These are special sizes
|
// These are special sizes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user