use bytesname trait to explicitly convert &str/string to ascii lower-cased byte names of server / path

This commit is contained in:
Jun Kurihara 2022-07-28 20:45:22 +09:00
commit 7bd9040637
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
10 changed files with 49 additions and 46 deletions

View file

@ -1,7 +1,10 @@
mod upstream;
mod upstream_opts;
use crate::log::*;
use crate::{
log::*,
utils::{BytesName, PathNameBytesExp, ServerNameBytesExp},
};
use rustc_hash::FxHashMap as HashMap;
use std::{
fs::File,
@ -17,11 +20,6 @@ use tokio_rustls::rustls::{
pub use upstream::{ReverseProxy, Upstream, UpstreamGroup};
pub use upstream_opts::UpstreamOption;
// Server name (hostname or ip address) and path name representation in backends
// For searching hashmap or key list by exact or longest-prefix matching
pub type ServerNameBytesExp = Vec<u8>; // lowercase ascii bytes
pub type PathNameBytesExp = Vec<u8>; // lowercase ascii bytes
/// Struct serving information to route incoming connections, like server name to be handled and tls certs/keys settings.
pub struct Backend {
pub app_name: String,