-
Notifications
You must be signed in to change notification settings - Fork 989
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
feat: Add WebRTC transport #2622
Merged
Merged
Changes from 225 commits
Commits
Show all changes
264 commits
Select commit
Hold shift + click to select a range
3c7f796
fix feature syntax err
melekes d5b2e09
enable webrtc by default (temporary)
melekes bd8091f
Revert "enable webrtc by default (temporary)"
melekes 6d703f8
add libp2p_webrtc to libp2p
melekes 64d60e9
fix ErrShortBuffer error by increasing the temporary buffer size
melekes e8207f9
Merge branch 'master' into anton/webrtc-transport
melekes d96b499
update to support new Transport interface
melekes 0e5b812
remove unused func and cleanup imports
melekes 809d23e
remove commented methods
melekes a31f1bf
uncomment flushing and closing in poll_close
melekes 414f945
refactor in_addr and listeners
melekes 84c5461
support ipv6 as well
melekes 66f6c78
format code
melekes 8ca428c
disable fingerprint verification on server side
melekes 802c012
Merge branch 'master' into anton/webrtc-transport
melekes cf2c11d
flatten StreamMuxer interface
melekes 35bc4eb
get rid of `loop` in UDPMuxNewAddr
melekes 212936f
brush up code
melekes 4643359
add close_listener test
melekes e32aa57
updates after @thomaseizinger review
melekes cd7786f
extract webrtc related logic into a sep mod
melekes 8306743
extract perform_noise_handshake fn
melekes 136edc2
fix addr in smoke test
melekes 6a11aa0
generate random ufrag when connecting
melekes d0c95a4
updates after @mxinden review
melekes ef5e306
return None in WebRTCListenStream when udp_mux is closed
melekes 04542f8
revert ef5e3065
melekes 273bd2c
fix doc links
melekes 5abaec4
introduce WebRTCConfiguration wrapper
melekes a4e7be4
perform_noise_handshake over abstract AsyncRead/Write
melekes 29ff7c9
poll API fro UDPMuxNewAddr
melekes da94baf
add Fingerprint type
melekes 385c51e
updates after @thomaseizinger review
melekes ecf7250
simplify create_initial_upgrade_data_channel negotiated arg
melekes e781ef5
closed detached channel if failed to send
melekes f5f930f
fix smoke test
melekes 604fcc8
reset outbound_fut and close_fut
melekes 8bd8233
add concurrent_connections_and_streams test
melekes 9821580
Merge branch 'master' into anton/webrtc-transport
melekes 59894fb
get rid of ConnectionInner
melekes b770a04
point webrtc and webrtc-data crates to master (temp)
melekes 59617de
transports/webrtc/: Test message framing sizes
mxinden 7dc3ce1
transports/webrtc/: Implement message framing
mxinden 503e32f
transports/webrtc: Update protobuf
mxinden 59e0ded
transports/webrtc/: Remove pin_project dependency (#2)
mxinden a2c74c6
get rid of negotiated arg
melekes 3effb2e
Reduce webrtc dependency to a single one (#3)
thomaseizinger 71e56dd
multiaddr 0.15 (master)
melekes 38175fd
Refactor `UdpMuxNewAddr` to be lock-less (#1)
thomaseizinger 9ff67a3
update webrtc version
melekes 9b1547d
Don't use versions for dev-dependencies (#6)
thomaseizinger 91df66c
Remove unnecessary `async` from `create_swarm` (#5)
thomaseizinger 8d0006b
fix smoke test
melekes bcdb4ef
Merge branch 'master' into anton/webrtc-transport
melekes 6399627
Connection: rename poll_address_change to poll
melekes 22e97a0
Merge remote-tracking branch 'melekes/anton/webrtc-transport' into we…
mxinden 55da918
transports/webrtc/: Change semantic of RESET
mxinden a2ae49f
sdp: move pub functions up
melekes 31ae422
simplify IfWatcher integration
melekes e0fe0de
Fix `dial_failure` test
thomaseizinger 2163b4b
Fix clippy warnings
thomaseizinger 4b23256
Revert "Fix `dial_failure` test"
thomaseizinger 23e779b
Fix more clippy lints
thomaseizinger 44506ee
Make `concurrent_connections_and_streams` pass by not using quickcheck
thomaseizinger bb29c7a
Fix intra doc link and adjust docs
thomaseizinger 11c016f
transports/webrtc/: Import message_proto types
mxinden 1a6e4bd
transports/webrtc/: Refactor AsyncRead match arm
mxinden d46a171
transports/webrtc/: Handle flags when read side closed
mxinden 9cd4ef7
transports/webrtc: Enforce maximum message length
mxinden 3a46fd0
upgrade webrtc-rs to 0.5.0
melekes af76971
Merge remote-tracking branch 'upstream/master' into anton/webrtc-tran…
melekes 018854d
fix Fingerprint::to_ufrag
melekes 31e019a
minor refactoring
melekes 6f57ed6
rename PollDataChannel to Substream
melekes 421a8ec
Merge branch 'master' into webrtc-message-framing
melekes 4a1d4d6
add comments
melekes c6c5a96
add debug to handle_flag
melekes 3d1d2f1
Merge branch 'master' into anton/webrtc-transport
melekes 7e630a6
use newly added NoiseConfig::with_prologue
melekes 2868d48
use into_authenticated fn
melekes 0c45291
Slim down public interface of `libp2p-webrtc`
thomaseizinger bbd7e75
Remove `Fingerprint` argument from `render_client_session_description`
thomaseizinger e84eb7b
Refactor `Fingerprint` type
thomaseizinger c709da9
Add test for noise_prologue
thomaseizinger 6ddf754
Remove `dbg!`
thomaseizinger 299575f
Fix tests not compiling
thomaseizinger d3da8f7
Don't use magic constants
thomaseizinger 5b44aca
Only pass fingerprint to `render_server_session_description`
thomaseizinger b052190
Fix clippy
thomaseizinger 1b0b671
Create noise-prologue from server + client FP in fixed order
thomaseizinger aa38c81
Make `substream` a top-level module
thomaseizinger d0e918b
Replace nightly feature with refactoring
thomaseizinger 171c613
Remove use of import rename
thomaseizinger cb481a6
Merge branch 'anton/webrtc-transport' into webrtc-message-framing
thomaseizinger 6402665
Remove unused public API
thomaseizinger d537696
Make sure we don't construct substreams outside of this crate
thomaseizinger c8c2446
Don't expose public APIs for temporary workarounds
thomaseizinger d58f219
Remove pub where not necessary
thomaseizinger eb09d36
Remove utilities below usage
thomaseizinger 99af2a1
Remove stale derive
thomaseizinger 2d85ab4
Update docs
thomaseizinger 6e2aeb1
Fix clippy warnings
thomaseizinger 2c900b5
change noise channel ID to 0
melekes 226f293
only allow one addr per ufrag
melekes a6b2aac
Revert "Create noise-prologue from server + client FP in fixed order"
thomaseizinger afac31c
Merge branch 'master' into webrtc-message-framing
thomaseizinger 71c390f
Merge branch 'master' into anton/webrtc-transport
thomaseizinger d5dcdd1
Update to latest core and noise version
thomaseizinger b43f861
Don't call `Transport::map` via trait
thomaseizinger fcf55b2
Append certhash to emitted listen address
thomaseizinger 979b179
Remove unnecessary `pub`
thomaseizinger 1055efc
Follow naming convention of other transports
thomaseizinger c5ca42d
Don't require users to generate a certificate themselves
thomaseizinger 0942424
Only calculate fingerprint once
thomaseizinger e59b93b
Use naming convention of other transports
thomaseizinger 2133789
Remove `Fingerprint` from public API
thomaseizinger 87f138b
Move utilities to the bottom of the file
thomaseizinger 7fc56ed
Be consistent in how we import symbols
thomaseizinger 969d037
Parse certhash before starting dial
thomaseizinger 5e7b964
Refactor multiaddr parsing
thomaseizinger 268d0fc
Remove unused error variant
thomaseizinger ba71d9b
Don't use `#[from]` if we never use it
thomaseizinger 7452c4b
Don't repeat `Error` name in variant
thomaseizinger 15a09ad
Rename noise error variant and improve printed log
thomaseizinger 69e2f59
Don't have errors print their inner source
thomaseizinger d0a0bb6
Straight up require addresses to specify a peer ID
thomaseizinger 3d38e93
Move noise upgrades to dedicated module
thomaseizinger 43eb42a
Have `WebRTCConnection::{accept,connect}` to the entire upgrade
thomaseizinger a989577
Make `setting_engine` a free function
thomaseizinger d5e67c2
Move `WebRTCConnection` to `upgrade` module
thomaseizinger 410fc77
Simplify call to `WebRTCConnection::connect`
thomaseizinger d363369
Inline `upgrade` function
thomaseizinger 7108323
Fix imports and modules
thomaseizinger 41f7ab1
Remove unnecessary path prefix
thomaseizinger 0ba6954
Get rid of `WebRTCConnection` object
thomaseizinger 9e3c1db
Extract helper for creating random ufrag
thomaseizinger 88c29fb
Extract helpers for new connections
thomaseizinger a2136c9
Inline `api` variable
thomaseizinger 116e498
Don't use boolean arguments when we can match on an enum
thomaseizinger 2935ca7
Only set read_buf_capacity once
thomaseizinger 033e485
Close data channel before verifying peer ID
thomaseizinger c5c5b8d
Improve variable naming
thomaseizinger ef45b58
Directly return RTCSessionDescription from `sdp` module
thomaseizinger d4c89bf
Remove unnecessary `pub(crate)`
thomaseizinger 4795f81
Consistent structure between inbound and outbound fns
thomaseizinger e0bec13
Consistent logging
thomaseizinger ba961c3
Remove log before noise handshake
thomaseizinger f5f4476
Inline `ufrag` variable
thomaseizinger f643e09
Improve naming of `sdp` module functions
thomaseizinger 8a74009
Remove superfluous comments
thomaseizinger b9917d5
Replace `select` macro with `select` fn
thomaseizinger f5d105e
Close noise data channel as part of upgrade
thomaseizinger d4448ad
Group creation of arguments to next fn together
thomaseizinger afa35bb
Remove need for comment by renaming function
thomaseizinger 030d210
Remove outdated comment
thomaseizinger ceba78e
Perform peer ID check outside of ugprade functions
thomaseizinger ed9fad1
Remove WebRTC prefix
thomaseizinger 06be476
Remove wrong log
thomaseizinger 5d20a00
Don't import log macros
thomaseizinger 52c9705
Inline variable
thomaseizinger afaaea9
Remove duplicate logging
thomaseizinger c032343
Remove duplication in constructing local addr
thomaseizinger 3d44ac4
Better use of whitespace
thomaseizinger e98a981
Remove superfluous logs
thomaseizinger f5095a0
Remove duplication in `poll_if_watcher`
thomaseizinger 09235a3
Remove unnecessary functions from `Config`
thomaseizinger b2cee23
Reduce boilerplate in `do_listen`
thomaseizinger dce2371
Inline `do_listen`
thomaseizinger 577a24e
Less verbose error mapping
thomaseizinger fab5a32
Inline `webrtc` in `full` feature
thomaseizinger 316052c
Log new connections on debug
thomaseizinger ee8fe4e
Make noise module private
thomaseizinger c5b86d7
Move test utils to bottom
thomaseizinger db45602
Fix formatting issues
thomaseizinger 85aa4ef
Fix clippy lints
thomaseizinger 8709473
Merge branch 'master' into anton/webrtc-transport
melekes f6431fb
remove TODO
melekes 8266fc4
Merge remote-tracking branch 'melekes/anton/webrtc-transport' into we…
thomaseizinger d2da793
Add initial test suite for substream state machine
thomaseizinger 1b520a9
Precompute substream ID
thomaseizinger e483974
Implement new state machine
thomaseizinger 29d6f74
Reset flag clears buffer
thomaseizinger d829fda
Remove substream ID
thomaseizinger 058a153
Remove use of `map_err`
thomaseizinger e1df3c4
Replace error with `Poll::Pending`
thomaseizinger 8c8feaa
Remove unnecessary dependency
thomaseizinger e6c177c
Group imports
thomaseizinger b2961a0
Add spec wording to constant
thomaseizinger f827f62
Introduce dedicated `State` submodule
thomaseizinger 16433db
Send reset flag for dropped substreams
thomaseizinger 834ec64
Fix clippy warnings
thomaseizinger 7e0e46d
Fix docs
thomaseizinger 225453b
Merge pull request #10 from libp2p/webrtc-message-framing
melekes 35e2c50
fixed order for fingerprints in Noise prologue
melekes de191a6
reverse the noise roles
melekes c435df0
don't use Multihash in Noise prologue
melekes 95665ec
add comments to Fingerprint
melekes 67a13b8
fix doc links
melekes 806d7e3
Revert "don't use Multihash in Noise prologue"
melekes 114f539
rename noise functions
melekes e7f9dc2
Merge branch 'master' into anton/webrtc-transport
melekes 6c8cce9
don't clone the raw `mpsc::Sender`
melekes c89f95a
add some comments
melekes 84032f0
do not allocate read buffer every time
melekes ef6bf9b
Merge branch 'master' into anton/webrtc-transport
melekes 3d3951f
remove default-features flag from libp2p-core
melekes 3fae663
rename tokio-crate to tokio
melekes 05a9b00
set noise data channel label to `noise`
melekes f7c8ab5
move transport into `tokio` dir and feature gate it
melekes 1785a85
enable tokio feature on libp2p-webrtc
melekes 8ddd225
empty data channel labels
melekes 6326131
apply suggestions from @mxinden
melekes fe84427
bump prost-codec version
melekes 0810bed
replace unwrap with expect
melekes 5429e55
add missing licences
melekes 82edf3f
rename FramedDC to FramedDc and listen_multi_address fn
melekes 7af1e80
remove obsolete comment
melekes 7eb35f2
specify correct version of libp2p-webrtc
melekes 532b410
remove duplicated check
melekes 9238efc
don't do framing during noise handshake
melekes 4d1cb7c
Revert "don't do framing during noise handshake"
melekes 3383872
set max-message-size to 16384
melekes 93ea5d4
add end-of-candidates attribute to server's SDP
melekes ce8e742
make certificate an argument in `Transport::new`
melekes 03cbefd
set `PollDataChannel` read buffer size to the frame max size
melekes 61b00f9
remove pathed multiaddr
melekes ba964f3
bump prost-codec to 0.2.1 (not 0.3.0)
melekes f5757b9
remove unused deps
melekes 0e9fcf2
release `peer_conn` lock as soon as possible
melekes c179ecd
update comment when creating noise stream
melekes 7d9d531
remove TODO from poll_flush
melekes c1e4297
make peer ID optional
melekes b4472a8
use the same ufrag for both client and server
melekes 9a80510
replace futures_lite w/ futures
melekes e5e9c46
Append `PeerId` to listen address
thomaseizinger 36012ed
prepare for deterministic certificates
melekes 19a8a6c
prefix ufrag
melekes 9e7c0eb
Merge branch 'master' into anton/webrtc-transport
thomaseizinger c41e930
Add `listen_ping` example
thomaseizinger d1c50b5
don't log empty label
melekes 35e02d2
set high watermark on Framed to frame size
melekes c7cb26b
correct max for `Framed` codec and `high_water_mark`
melekes e0a95d8
Merge branch 'master' into anton/webrtc-transport
melekes 58210d4
update webrtc-rs
melekes e1ba1d5
asynchronous-codec 0.6.1
melekes 430f6a8
rename to_multi_hash to to_multihash
melekes fc4bedb
add from_pem and serialize_pem to Certificate
melekes d2fc5f6
Merge branch 'master' into anton/webrtc-transport
melekes 06d53d9
format code
melekes 0b0be1d
remove webrtc-pem feature
melekes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[package] | ||
name = "libp2p-webrtc" | ||
version = "0.1.0" | ||
melekes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
authors = ["Parity Technologies <admin@parity.io>"] | ||
description = "WebRTC transport for libp2p" | ||
repository = "https://github.com/libp2p/rust-libp2p" | ||
license = "MIT" | ||
edition = "2021" | ||
keywords = ["peer-to-peer", "libp2p", "networking"] | ||
categories = ["network-programming", "asynchronous"] | ||
|
||
[dependencies] | ||
asynchronous-codec = "0.6" | ||
async-trait = "0.1" | ||
bytes = "1" | ||
fnv = "1.0" | ||
melekes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
futures = "0.3" | ||
futures-lite = "1" | ||
melekes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
futures-timer = "3" | ||
hex = "0.4" | ||
if-watch = "2.0" | ||
libp2p-core = { version = "0.37.0", path = "../../core" } | ||
libp2p-noise = { version = "0.40.0", path = "../../transports/noise" } | ||
log = "0.4" | ||
multihash = { version = "0.16", default-features = false, features = ["sha2"] } | ||
multibase = "0.9" | ||
prost = "0.11" | ||
prost-codec = { version = "0.2", path = "../../misc/prost-codec" } | ||
rand = "0.8" | ||
rcgen = "0.9.3" | ||
melekes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
serde = { version = "1.0", features = ["derive"] } | ||
stun = "0.4" | ||
thiserror = "1" | ||
tinytemplate = "1.2" | ||
|
||
tokio = { version = "1.18", features = ["net"], optional = true} | ||
tokio-util = { version = "0.7", features = ["compat"], optional = true } | ||
webrtc = { version = "0.5.0", optional = true } | ||
|
||
[features] | ||
tokio = ["dep:tokio", "dep:tokio-util", "dep:webrtc"] | ||
|
||
[build-dependencies] | ||
prost-build = "0.11" | ||
|
||
[dev-dependencies] | ||
anyhow = "1.0" | ||
env_logger = "0.9" | ||
hex-literal = "0.3" | ||
libp2p = { path = "../..", features = ["request-response", "webrtc"], default-features = false } | ||
multihash = { version = "0.16", default-features = false, features = ["sha3"] } | ||
quickcheck = "1" | ||
rand_core = "0.5" | ||
unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 Protocol Labs. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
fn main() { | ||
prost_build::compile_protos(&["src/message.proto"], &["src"]).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright 2022 Parity Technologies (UK) Ltd. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
//! Implementation of the [`libp2p_core::Transport`] trait for WebRTC protocol without a signaling | ||
//! server. | ||
//! | ||
//! # Overview | ||
//! | ||
//! ## ICE | ||
//! | ||
//! RFCs: 8839, 8445 See also: | ||
//! <https://tools.ietf.org/id/draft-ietf-rtcweb-sdp-08.html#rfc.section.5.2.3> | ||
//! | ||
//! The WebRTC protocol uses ICE in order to establish a connection. | ||
//! | ||
//! In a typical ICE setup, there are two endpoints, called agents, that want to communicate. One | ||
//! of these two agents can be the local browser, while the other agent is the target of the | ||
//! connection. | ||
//! | ||
//! Even though in this specific context all we want is a simple client-server communication, it is | ||
//! helpful to keep in mind that ICE was designed to solve the problem of NAT traversal. | ||
//! | ||
//! The ICE workflow works as follows: | ||
//! | ||
//! - An "offerer" determines ways in which it could be accessible (either an | ||
//! IP address or through a relay using a TURN server), which are called "candidates". It then | ||
//! generates a small text payload in a format called SDP, that describes the request for a | ||
//! connection. | ||
//! - The offerer sends this SDP-encoded message to the answerer. The medium through which this | ||
//! exchange is done is out of scope of the ICE protocol. | ||
//! - The answerer then finds its own candidates, and generates an answer, again in the SDP format. | ||
//! This answer is sent back to the offerer. | ||
//! - Each agent then tries to connect to the remote's candidates. | ||
//! | ||
//! We pretend to send the offer to the remote agent (the target of the connection), then pretend | ||
//! that it has found a valid IP address for itself (i.e. a candidate), then pretend that the SDP | ||
//! answer containing this candidate has been sent back. This will cause the offerer to execute | ||
//! step 4: try to connect to the remote's candidate. | ||
//! | ||
//! ## TCP or UDP | ||
//! | ||
//! WebRTC by itself doesn't hardcode any specific protocol for media streams. Instead, it is the | ||
//! SDP message of the offerer that specifies which protocol to use. In our use case (one or more | ||
//! data channels), we know that the offerer will always request either TCP+DTLS+SCTP, or | ||
//! UDP+DTLS+SCTP. | ||
//! | ||
//! The implementation only supports UDP at the moment, so if the offerer requests TCP+DTLS+SCTP, it | ||
//! will not respond. Support for TCP may be added in the future (see | ||
//! <https://github.com/webrtc-rs/webrtc/issues/132>). | ||
//! | ||
//! ## DTLS+SCTP | ||
//! | ||
//! RFCs: 8841, 8832 | ||
//! | ||
//! In both cases (TCP or UDP), the next layer is DTLS. DTLS is similar to the well-known TLS | ||
//! protocol, except that it doesn't guarantee ordering of delivery (as this is instead provided by | ||
//! the SCTP layer on top of DTLS). In other words, once the TCP or UDP connection is established, | ||
//! the browser will try to perform a DTLS handshake. | ||
//! | ||
//! During the ICE negotiation, each agent must include in its SDP packet a hash of the self-signed | ||
//! certificate that it will use during the DTLS handshake. In our use-case, where we try to | ||
//! hand-crate the SDP answer generated by the remote, this is problematic. A way to solve this | ||
//! is to make the hash a part of the remote's multiaddr. On the server side, we turn | ||
//! certificate verification off. | ||
|
||
mod message_proto { | ||
#![allow(clippy::derive_partial_eq_without_eq)] | ||
|
||
include!(concat!(env!("OUT_DIR"), "/webrtc.pb.rs")); | ||
} | ||
|
||
#[cfg(feature = "tokio")] | ||
pub mod tokio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto2"; | ||
|
||
package webrtc.pb; | ||
|
||
message Message { | ||
enum Flag { | ||
// The sender will no longer send messages on the stream. | ||
FIN = 0; | ||
// The sender will no longer read messages on the stream. Incoming data is | ||
// being discarded on receipt. | ||
STOP_SENDING = 1; | ||
// The sender abruptly terminates the sending part of the stream. The | ||
// receiver can discard any data that it already received on that stream. | ||
RESET = 2; | ||
} | ||
|
||
optional Flag flag=1; | ||
|
||
optional bytes message = 2; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 needs to happen before we can merge here. Who has access to this @mxinden?
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.
Thanks for the ping @thomaseizinger. I am on it. multiformats/rust-multiaddr#61
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.
For the record
multiaddr
v0.15.0
is now released.