Skip to content
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

Experiment with a WebRTC client #1938

Closed
wants to merge 11 commits into from
Closed

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Jan 21, 2022

cc #1712

Opening this PR as a draft, mostly to keep the overview that I wrote down.

The code in this PR makes the browser open a TCP connection to 127.0.0.1:41000.
I haven't experimented with a DTLS+SCTP server yet.

Copy link
Contributor

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2022

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼──────────────────
          +0 ┊ Σ [0 Total Rows]

@tomaka
Copy link
Contributor Author

tomaka commented Jan 28, 2022

The code in this PR causes Chrome to send UDP packets to the target IP address. Here's what the UDP packets look like (sampled):

[0, 1, 0, 80, 33, 18, 164, 66, 85, 57, 89, 118, 119, 54, 107, 122, 68, 104, 47, 73, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 182, 225, 121, 168, 185, 100, 50, 30, 148, 179, 186, 186, 102, 170, 30, 185, 198, 35, 151, 165, 128, 40, 0, 4, 240, 64, 154, 82]
[0, 1, 0, 80, 33, 18, 164, 66, 76, 89, 69, 99, 114, 98, 80, 118, 86, 49, 115, 120, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 227, 94, 105, 131, 50, 107, 7, 153, 218, 151, 138, 68, 235, 237, 11, 213, 104, 253, 200, 230, 128, 40, 0, 4, 7, 71, 25, 93]
[0, 1, 0, 80, 33, 18, 164, 66, 90, 106, 85, 43, 111, 102, 81, 55, 81, 70, 89, 90, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 5, 250, 68, 136, 190, 252, 253, 66, 9, 117, 185, 73, 34, 87, 159, 210, 0, 161, 121, 180, 128, 40, 0, 4, 160, 32, 77, 51]
[0, 1, 0, 80, 33, 18, 164, 66, 87, 79, 111, 82, 112, 110, 109, 113, 70, 112, 69, 118, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 210, 87, 139, 5, 61, 124, 209, 84, 61, 220, 141, 170, 92, 23, 46, 53, 5, 37, 246, 121, 128, 40, 0, 4, 36, 55, 70, 123]
[0, 1, 0, 80, 33, 18, 164, 66, 82, 80, 71, 87, 97, 66, 119, 51, 90, 100, 88, 43, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 110, 19, 133, 234, 218, 112, 177, 122, 9, 171, 33, 66, 60, 222, 99, 71, 172, 110, 71, 81, 128, 40, 0, 4, 47, 18, 50, 245]
[0, 1, 0, 80, 33, 18, 164, 66, 105, 80, 122, 71, 114, 103, 115, 121, 50, 57, 51, 100, 0, 6, 0, 11, 101, 56, 54, 101, 51, 49, 58, 101, 67, 120, 50, 0, 192, 87, 0, 4, 0, 0, 3, 231, 128, 42, 0, 8, 132, 114, 208, 65, 199, 193, 81, 224, 0, 37, 0, 0, 0, 36, 0, 4, 110, 0, 30, 255, 0, 8, 0, 20, 98, 12, 46, 36, 28, 177, 141, 67, 167, 131, 7, 120, 53, 118, 207, 104, 1, 73, 30, 36, 128, 40, 0, 4, 251, 211, 160, 136]

Unfortunately, this isn't a valid DTLS record, as bytes 2 and 3 of the packet are supposed to be a version number equal to 254 and 253 (see https://datatracker.ietf.org/doc/html/rfc6347#section-4.1).

@tomaka
Copy link
Contributor Author

tomaka commented Jan 28, 2022

This is because it's STUN traffic. Need to understand ICE better.

@tomaka
Copy link
Contributor Author

tomaka commented Jan 28, 2022

RFC 8445, section 7:

It is important to note that STUN requests are sent to and from the
exact same IP addresses and ports that will be used for data (e.g.,
RTP, RTCP, or other protocols). Consequently, agents demultiplex
STUN and data using the contents of the packets rather than the port
on which they are received.

@melekes
Copy link
Contributor

melekes commented Mar 10, 2022

Closing in favor of #2135.

@melekes melekes closed this Mar 10, 2022
@tomaka tomaka deleted the webrtc-experiment branch March 11, 2022 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants