Skip to content

Commit cc1a8f1

Browse files
committed
Change format to one line per sentence
Experimenting with whether this makes reviewing and git diffs simpler.
1 parent 5615e2f commit cc1a8f1

File tree

1 file changed

+26
-49
lines changed

1 file changed

+26
-49
lines changed

webrtc/browser-to-browser.md

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,45 @@
66

77
## Motivation
88

9-
1. **Hole punching in the browser**: Enable two browsers or a browser and a
10-
server node to connect even though one or both are behind a NAT / firewall.
9+
1. **Hole punching in the browser**: Enable two browsers or a browser and a server node to connect even though one or both are behind a NAT / firewall.
1110

1211
TODO: Doucment use-case where A is a browser and B is a non-browser but behind firewall and/or NAT.
1312

1413
## Connection Establishment
1514

1615
### Browser to Browser
1716

18-
Scenario: Browser _A_ wants to connect to Browser node _B_ with the help of
19-
server node _R_. Both _A_ and _B_ can not listen for incoming connections due to
20-
the restriction of the browser platform and being behind a NAT and/or firewall.
17+
Scenario: Browser _A_ wants to connect to Browser node _B_ with the help of server node _R_.
18+
Both _A_ and _B_ can not listen for incoming connections due to the restriction of the browser platform and being behind a NAT and/or firewall.
2119

22-
TODO: Define which node on a relayed connection is _A_ and which one is _B_,
23-
i.e. which one initiates (offer) and which one responds (answer).
20+
TODO: Define which node on a relayed connection is _A_ and which one is _B_, i.e. which one initiates (offer) and which one responds (answer).
2421

25-
1. _A_ and _B_ establish a relayed connection through some protocol, e.g. the
26-
Circuit Relay v2 protocol. Note that further steps depend on the relayed
27-
connection to be authenticated, i.e. that data send on the relayed connection
28-
can be trusted.
22+
1. _A_ and _B_ establish a relayed connection through some protocol, e.g. the Circuit Relay v2 protocol.
23+
Note that further steps depend on the relayed connection to be authenticated, i.e. that data send on the relayed connection can be trusted.
2924

30-
2. _A_ creates an `RTCPeerConnection`. See [#STUN] on what STUN servers to
31-
configure at creation time. _A_ creates an SDP offer via
32-
`RTCPeerConnection.createOffer()`. _A_ initiates the signaling protocol to _B_
33-
via the relayed connection from (1), see [#Signaling protocol] and sends the
34-
offer to _B_.
25+
2. _A_ creates an `RTCPeerConnection`.
26+
See [#STUN] on what STUN servers to configure at creation time.
27+
_A_ creates an SDP offer via `RTCPeerConnection.createOffer()`.
28+
_A_ initiates the signaling protocol to _B_ via the relayed connection from (1), see [#Signaling protocol] and sends the offer to _B_.
3529

36-
3. _B_ creates an `RTCPeerConnection`. Again see [#STUN] on what STUN servers to
37-
configure at creation time. _B_ receives _A_'s offer send in (2) via the
38-
signaling protocol stream and provides the offer to its `RTCPeerConnection`
39-
via `RTCPeerConnection.setRemoteDescription`. _B_ then creates an answer via
40-
`RTCPeerConnection.createAnswer` and sends it to _A_ via the existing
41-
signaling protocol stream (see [#signaling protocol]).
30+
3. _B_ creates an `RTCPeerConnection`.
31+
Again see [#STUN] on what STUN servers to configure at creation time.
32+
_B_ receives _A_'s offer send in (2) via the signaling protocol stream and provides the offer to its `RTCPeerConnection` via `RTCPeerConnection.setRemoteDescription`.
33+
_B_ then creates an answer via `RTCPeerConnection.createAnswer` and sends it to _A_ via the existing signaling protocol stream (see [#signaling protocol]).
4234

43-
4. _A_ receives _B_'s answer via the signaling protocol stream and sets it
44-
locally via `RTCPeerConnection.setRemoteDescription`.
35+
4. _A_ receives _B_'s answer via the signaling protocol stream and sets it locally via `RTCPeerConnection.setRemoteDescription`.
4536

4637
5. TODO: Define ICE candidate exchange.
4738

48-
5. Messages on `RTCDataChannel`s on the established `RTCPeerConnection` are
49-
framed using the message framing mechanism described in
50-
[Multiplexing](#multiplexing).
39+
5. Messages on `RTCDataChannel`s on the established `RTCPeerConnection` are framed using the message framing mechanism described in [Multiplexing](#multiplexing).
5140

52-
The above browser-to-browser WebRTC connection establishment replaces the
53-
existing [libp2p WebRTC star](https://github.com/libp2p/js-libp2p-webrtc-star)
54-
and [libp2p WebRTC direct](https://github.com/libp2p/js-libp2p-webrtc-direct)
55-
protocols.
41+
The above browser-to-browser WebRTC connection establishment replaces the existing [libp2p WebRTC star](https://github.com/libp2p/js-libp2p-webrtc-star) and [libp2p WebRTC direct](https://github.com/libp2p/js-libp2p-webrtc-direct) protocols.
5642

5743
#### Open Questions
5844

59-
- Instead of using trickle ICE, we could as well wait for the candidate
60-
gathering. See
61-
https://github.com/pion/webrtc/blob/c1467e4871c78ee3f463b50d858d13dc6f2874a4/examples/insertable-streams/main.go#L141-L142
62-
as one example. In the browser, one can wait for the
63-
[`icegatheringstatechange`
64-
event](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/icegatheringstatechange_event).
45+
- Instead of using trickle ICE, we could as well wait for the candidate gathering.
46+
See https://github.com/pion/webrtc/blob/c1467e4871c78ee3f463b50d858d13dc6f2874a4/examples/insertable-streams/main.go#L141-L142 as one example.
47+
In the browser, one can wait for the [`icegatheringstatechange` event](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/icegatheringstatechange_event).
6548

6649
## STUN
6750

@@ -73,9 +56,7 @@ TODO: Extend
7356

7457
Protocol id `/webrtc-direct`
7558

76-
Messages are sent prefixed with the message length in bytes, encoded as an
77-
unsigned variable length integer as defined by the [multiformats unsigned-varint
78-
spec][uvarint-spec].
59+
Messages are sent prefixed with the message length in bytes, encoded as an unsigned variable length integer as defined by the [multiformats unsigned-varint spec][uvarint-spec].
7960

8061
``` protobuf
8162
// TODO: Support for offer, answer and ICE candidates
@@ -85,13 +66,9 @@ spec][uvarint-spec].
8566

8667
- Why is there no additional Noise handshake needed?
8768

88-
This specification (browser-to-browser) requires _A_ and _B_ to exchange their
89-
SDP offer and answer over an authenticated channel. Offer and answer contain
90-
the TLS certificate fingerprint. The browser validates the TLS certificate
91-
fingerprint through the TLS handshake on the direct connection.
69+
This specification (browser-to-browser) requires _A_ and _B_ to exchange their SDP offer and answer over an authenticated channel.
70+
Offer and answer contain the TLS certificate fingerprint.
71+
The browser validates the TLS certificate fingerprint through the TLS handshake on the direct connection.
9272

93-
In contrast, the browser-to-server specification allows exchange of the
94-
server's multiaddr, containing the server's TLS certificate fingerprint, over
95-
unauthenticated channels. In other words, the browser-to-server specification
96-
does not consider the TLS certificate fingerprint in the server's multiaddr to
97-
be trusted.
73+
In contrast, the browser-to-server specification allows exchange of the server's multiaddr, containing the server's TLS certificate fingerprint, over unauthenticated channels.
74+
In other words, the browser-to-server specification does not consider the TLS certificate fingerprint in the server's multiaddr to be trusted.

0 commit comments

Comments
 (0)