mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-20 18:23:41 +00:00
Perf: Prefer more efficient cipher suites
Prefer AES128 in order to maximize throughput
This commit is contained in:
committed by
Dirkjan Ochtman
parent
82a065ac3e
commit
3de2727b94
+14
-2
@@ -80,12 +80,24 @@ async fn run(opt: Opt) -> Result<()> {
|
||||
let mut cfg = quinn::ClientConfigBuilder::default();
|
||||
cfg.protocols(&[b"perf"]);
|
||||
let mut cfg = cfg.build();
|
||||
|
||||
let tls_config: &mut rustls::ClientConfig = Arc::get_mut(&mut cfg.crypto).unwrap();
|
||||
if opt.insecure {
|
||||
let tls_cfg: &mut rustls::ClientConfig = Arc::get_mut(&mut cfg.crypto).unwrap();
|
||||
tls_cfg
|
||||
tls_config
|
||||
.dangerous()
|
||||
.set_certificate_verifier(SkipServerVerification::new());
|
||||
}
|
||||
// Configure cipher suites for efficiency
|
||||
tls_config.ciphersuites.clear();
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_AES_128_GCM_SHA256);
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_AES_256_GCM_SHA384);
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_CHACHA20_POLY1305_SHA256);
|
||||
|
||||
let stats = Arc::new(Mutex::new(Stats::default()));
|
||||
|
||||
|
||||
+15
-2
@@ -1,4 +1,4 @@
|
||||
use std::{fs, net::SocketAddr, path::PathBuf};
|
||||
use std::{fs, net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use bytes::Bytes;
|
||||
@@ -57,7 +57,20 @@ async fn run(opt: Opt) -> Result<()> {
|
||||
server_config.certificate(cert, key).unwrap();
|
||||
server_config.protocols(&[b"perf"]);
|
||||
|
||||
let server_config = server_config.build();
|
||||
let mut server_config = server_config.build();
|
||||
|
||||
// Configure cipher suites for efficiency
|
||||
let tls_config = Arc::get_mut(&mut server_config.crypto).unwrap();
|
||||
tls_config.ciphersuites.clear();
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_AES_128_GCM_SHA256);
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_AES_256_GCM_SHA384);
|
||||
tls_config
|
||||
.ciphersuites
|
||||
.push(&rustls::ciphersuite::TLS13_CHACHA20_POLY1305_SHA256);
|
||||
|
||||
let mut endpoint = quinn::EndpointBuilder::default();
|
||||
endpoint.listen(server_config);
|
||||
|
||||
Reference in New Issue
Block a user