-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Rename Protocol::WebRTC
to Protocol::WebRTCDirect
#78
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ const IP4: u32 = 4; | |
const IP6: u32 = 41; | ||
const P2P_WEBRTC_DIRECT: u32 = 276; | ||
const P2P_WEBRTC_STAR: u32 = 275; | ||
const WEBRTC: u32 = 280; | ||
const WEBRTC_DIRECT: u32 = 280; | ||
const CERTHASH: u32 = 466; | ||
const P2P_WEBSOCKET_STAR: u32 = 479; | ||
const MEMORY: u32 = 777; | ||
|
@@ -92,7 +92,7 @@ pub enum Protocol<'a> { | |
Ip6(Ipv6Addr), | ||
P2pWebRtcDirect, | ||
P2pWebRtcStar, | ||
WebRTC, | ||
WebRTCDirect, | ||
Certhash(Multihash), | ||
P2pWebSocketStar, | ||
/// Contains the "port" to contact. Similar to TCP or UDP, 0 means "assign me a port". | ||
|
@@ -210,11 +210,7 @@ impl<'a> Protocol<'a> { | |
} | ||
"p2p-websocket-star" => Ok(Protocol::P2pWebSocketStar), | ||
"p2p-webrtc-star" => Ok(Protocol::P2pWebRtcStar), | ||
"webrtc" => { | ||
log::warn!("Parsed deprecated /webrtc. Use /webrtc-direct instead."); | ||
Ok(Protocol::WebRTC) | ||
} | ||
"webrtc-direct" => Ok(Protocol::WebRTC), | ||
"webrtc-direct" => Ok(Protocol::WebRTCDirect), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I must say having both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could as well deprecate |
||
"certhash" => { | ||
let s = iter.next().ok_or(Error::InvalidProtocolString)?; | ||
let (_base, decoded) = multibase::decode(s)?; | ||
|
@@ -296,7 +292,7 @@ impl<'a> Protocol<'a> { | |
} | ||
P2P_WEBRTC_DIRECT => Ok((Protocol::P2pWebRtcDirect, input)), | ||
P2P_WEBRTC_STAR => Ok((Protocol::P2pWebRtcStar, input)), | ||
WEBRTC => Ok((Protocol::WebRTC, input)), | ||
WEBRTC_DIRECT => Ok((Protocol::WebRTCDirect, input)), | ||
CERTHASH => { | ||
let (n, input) = decode::usize(input)?; | ||
let (data, rest) = split_at(n, input)?; | ||
|
@@ -479,7 +475,7 @@ impl<'a> Protocol<'a> { | |
} | ||
Protocol::P2pWebSocketStar => w.write_all(encode::u32(P2P_WEBSOCKET_STAR, &mut buf))?, | ||
Protocol::P2pWebRtcStar => w.write_all(encode::u32(P2P_WEBRTC_STAR, &mut buf))?, | ||
Protocol::WebRTC => w.write_all(encode::u32(WEBRTC, &mut buf))?, | ||
Protocol::WebRTCDirect => w.write_all(encode::u32(WEBRTC_DIRECT, &mut buf))?, | ||
Protocol::Certhash(hash) => { | ||
w.write_all(encode::u32(CERTHASH, &mut buf))?; | ||
let bytes = hash.to_bytes(); | ||
|
@@ -511,7 +507,7 @@ impl<'a> Protocol<'a> { | |
Ip6(a) => Ip6(a), | ||
P2pWebRtcDirect => P2pWebRtcDirect, | ||
P2pWebRtcStar => P2pWebRtcStar, | ||
WebRTC => WebRTC, | ||
WebRTCDirect => WebRTCDirect, | ||
Certhash(hash) => Certhash(hash), | ||
P2pWebSocketStar => P2pWebSocketStar, | ||
Memory(a) => Memory(a), | ||
|
@@ -549,7 +545,7 @@ impl<'a> Protocol<'a> { | |
Ip6(_) => "ip6", | ||
P2pWebRtcDirect => "p2p-webrtc-direct", | ||
P2pWebRtcStar => "p2p-webrtc-star", | ||
WebRTC => "webrtc-direct", | ||
WebRTCDirect => "webrtc-direct", | ||
Certhash(_) => "certhash", | ||
P2pWebSocketStar => "p2p-websocket-star", | ||
Memory(_) => "memory", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means we can then later add
WebRTC
in a non-breaking way right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct