https://github.com/quininer/ktls
[deprecated] Linux Kernel TLS for Rust.
https://github.com/quininer/ktls
ktls rustls tls tokio
Last synced: 11 months ago
JSON representation
[deprecated] Linux Kernel TLS for Rust.
- Host: GitHub
- URL: https://github.com/quininer/ktls
- Owner: quininer
- License: mit
- Created: 2018-09-22T17:38:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T07:11:50.000Z (over 7 years ago)
- Last Synced: 2025-04-03T02:41:19.614Z (about 1 year ago)
- Topics: ktls, rustls, tls, tokio
- Language: Rust
- Homepage:
- Size: 38.1 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Linux KTLS for Rust
KTLS is a new feature introduced in Linux 4.13 that performs TLS encryption in the kernel.
This will allow us to implement performance optimizations that were previously impossible.
### Usage
First we need to make sure that kernel module is enabled
```
> sudo modprobe tls
> modinfo tls
...
```
Then we need to use rustls to handshake
```rust
use tokio_rustls::TlsConnector;
use tokio_rusktls::KtlsStream;
// ...
let connector = TlsConnector::from(config);
TcpStream::connect(&addr)
.and_then(|sock| connector.connect(dnsname, sock))
.and_then(|stream| {
let (io, session) = stream.into_inner();
KtlsStream::new(io, &session)
.map_err(|err| err.error)
})
// ...
```
Please note that `ktls` currently only supports TLS 1.2 and AES-GCM 128.
Other algorithms will return `Error`.
### License
This project is licensed under [the MIT license](LICENSE).