aquatic_ws: mio: replace native_tls with rustls, rewrite connection state logic completely (#38)

* ws: mio: use rustls, rewrite Connection logic

* ws: mio: improve poll register/deregister handling

* ws: mio: work on type-level poll registry safety

* ws: mio: use stronger poll registry type-level guarantees

* ws: mio: fix stream reading

* ws: clean up, run fmt

* ws: mio: don't require registered connection for writing, improve docs

* ws: mio: add Connection::get_meta(), make Connection::meta private

* ws: mio: add ConnectionMap struct; remove utils.rs

* ws: mio: move token counter into ConnectionMap, improve docs

* ws: mio: connection: move Connection struct above state structs

* Update TODO

* ws: fix build errors

* ws: upgrade to tungstenite 0.16

* ws load test: don't panic on Close message; print shorter errors

* ws: fix socket worker bugs, add log statements

* ws: mio: wait for write availability if would block for ws messages

* Update README

* ws: mio: limit channels & queues; read 1 message only; other fixes

* ws: mio: send local responses each event; decrease channel size

* Update TODO

* ws: mio: limit ws send queue, fixing memory leak; limit pending messages

Also change some log output levels and run rustfmt

* Update TODO

* Update TODO
This commit is contained in:
Joakim Frostegård 2021-12-16 15:09:36 +00:00 committed by GitHub
parent 222fac0e09
commit 67c4c02bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 893 additions and 776 deletions

View file

@ -17,7 +17,7 @@ of sub-implementations for different protocols:
|--------------|--------------------------------------------|------------------------------------------------------------|
| aquatic_udp | [BitTorrent over UDP] | Unix-like |
| aquatic_http | [BitTorrent over HTTP] with TLS ([rustls]) | Linux 5.8+ |
| aquatic_ws | [WebTorrent] | Unix-like with [mio] (default) / Linux 5.8+ with [glommio] |
| aquatic_ws | [WebTorrent] over TLS ([rustls]) | Unix-like with [mio] (default) / Linux 5.8+ with [glommio] |
## Usage
@ -166,28 +166,11 @@ tls_private_key_path = './key.pem'
Aims for compatibility with [WebTorrent](https://github.com/webtorrent)
clients, with some exceptions:
* Only runs over TLS
* Doesn't track of the number of torrent downloads (0 is always sent).
* Doesn't allow full scrapes, i.e. of all registered info hashes
#### TLS: mio version
To run over TLS, a pkcs12 file (`.pkx`) is needed. It can be generated from
Let's Encrypt certificates as follows, assuming you are in the directory where
they are stored:
```sh
openssl pkcs12 -export -out identity.pfx -inkey privkey.pem -in cert.pem -certfile fullchain.pem
```
Enter a password when prompted. Then move `identity.pfx` somewhere suitable,
and enter the path into the tracker configuration field `tls_pkcs12_path`. Set
the password in the field `tls_pkcs12_password` and set `use_tls` to true.
#### TLS: glommio version
The glommio version only runs over TLS. For setup instructions, please see
`aquatic_http` TLS section above.
For TLS setup instructions, please see `aquatic_http` TLS section above.
#### Benchmarks