set default sni
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
5028eff519
commit
73ebf99243
1 changed files with 6 additions and 2 deletions
|
@ -66,7 +66,7 @@ pub struct ForwardProxyCommand {
|
|||
pub listen: String,
|
||||
|
||||
#[clap(short, long)]
|
||||
pub sni: String,
|
||||
pub sni: Option<String>,
|
||||
|
||||
#[clap(short, long)]
|
||||
pub target: String,
|
||||
|
@ -328,7 +328,11 @@ pub async fn forward_proxy(opts: ForwardProxyCommand) -> Result<(), Box<dyn std:
|
|||
let listener = tokio::net::TcpListener::bind(&opts.listen).await?;
|
||||
log::info!("Listening on: {}", opts.listen);
|
||||
|
||||
let sni = ServerName::try_from(opts.sni.as_str()).expect("Failed to parse SNI");
|
||||
let sni = ServerName::try_from(match opts.sni {
|
||||
Some(ref s) => s.as_str(),
|
||||
None => opts.target.as_str(),
|
||||
})
|
||||
.expect("Failed to parse SNI");
|
||||
loop {
|
||||
let (pt_stream, _) = match listener.accept().await {
|
||||
Ok(s) => s,
|
||||
|
|
Loading…
Reference in a new issue