Skip to content

Commit

Permalink
fix udp protocol code
Browse files Browse the repository at this point in the history
It was changed from 17 to 273 in
multiformats/multicodec#16.
  • Loading branch information
Stebalien committed Nov 28, 2018
1 parent 830dfde commit 839cb58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {Result, Error};
pub enum Protocol {
IP4 = 4,
TCP = 6,
UDP = 17,
UDP = 273,
DCCP = 33,
IP6 = 41,
DNS4 = 54,
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Protocol {
match raw {
4 => Ok(Protocol::IP4),
6 => Ok(Protocol::TCP),
17 => Ok(Protocol::UDP),
273 => Ok(Protocol::UDP),
33 => Ok(Protocol::DCCP),
41 => Ok(Protocol::IP6),
54 => Ok(Protocol::DNS4),
Expand Down
16 changes: 8 additions & 8 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,29 @@ fn construct_success() {
ma_valid("/ip6/2601:9:4f81:9700:803e:ca65:66e8:c21",
"29260100094F819700803ECA6566E80C21",
vec![IP6]);
ma_valid("/udp/0", "110000", vec![UDP]);
ma_valid("/udp/0", "91020000", vec![UDP]);
ma_valid("/tcp/0", "060000", vec![TCP]);
ma_valid("/sctp/0", "84010000", vec![SCTP]);
ma_valid("/udp/1234", "1104D2", vec![UDP]);
ma_valid("/udp/1234", "910204D2", vec![UDP]);
ma_valid("/tcp/1234", "0604D2", vec![TCP]);
ma_valid("/sctp/1234", "840104D2", vec![SCTP]);
ma_valid("/udp/65535", "11FFFF", vec![UDP]);
ma_valid("/udp/65535", "9102FFFF", vec![UDP]);
ma_valid("/tcp/65535", "06FFFF", vec![TCP]);
ma_valid("/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC",
"A503221220D52EBB89D85B02A284948203A62FF28389C57C9F42BEEC4EC20DB76A68911C0B",
vec![IPFS]);
ma_valid("/udp/1234/sctp/1234", "1104D2840104D2", vec![UDP, SCTP]);
ma_valid("/udp/1234/udt", "1104D2AD02", vec![UDP, UDT]);
ma_valid("/udp/1234/utp", "1104D2AE02", vec![UDP, UTP]);
ma_valid("/udp/1234/sctp/1234", "910204D2840104D2", vec![UDP, SCTP]);
ma_valid("/udp/1234/udt", "910204D2AD02", vec![UDP, UDT]);
ma_valid("/udp/1234/utp", "910204D2AE02", vec![UDP, UTP]);
ma_valid("/tcp/1234/http", "0604D2E003", vec![TCP, HTTP]);
ma_valid("/tcp/1234/https", "0604D2BB03", vec![TCP, HTTPS]);
ma_valid("/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234",
"A503221220D52EBB89D85B02A284948203A62FF28389C57C9F42BEEC4EC20DB76A68911C0B0604D2",
vec![IPFS, TCP]);
ma_valid("/ip4/127.0.0.1/udp/1234",
"047F0000011104D2",
"047F000001910204D2",
vec![IP4, UDP]);
ma_valid("/ip4/127.0.0.1/udp/0", "047F000001110000", vec![IP4, UDP]);
ma_valid("/ip4/127.0.0.1/udp/0", "047F00000191020000", vec![IP4, UDP]);
ma_valid("/ip4/127.0.0.1/tcp/1234",
"047F0000010604D2",
vec![IP4, TCP]);
Expand Down

0 comments on commit 839cb58

Please sign in to comment.