mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-19 00:07:24 +08:00
easytier-web add websocket support (#901)
Co-authored-by: xzzpig <w2xzzig@hotmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ use easytier::{
|
|||||||
constants::EASYTIER_VERSION,
|
constants::EASYTIER_VERSION,
|
||||||
error::Error,
|
error::Error,
|
||||||
},
|
},
|
||||||
tunnel::{tcp::TcpTunnelListener, udp::UdpTunnelListener, TunnelListener},
|
tunnel::{tcp::TcpTunnelListener, udp::UdpTunnelListener, websocket::WSTunnelListener, TunnelListener},
|
||||||
utils::{init_logger, setup_panic_handler},
|
utils::{init_logger, setup_panic_handler},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ mod web;
|
|||||||
rust_i18n::i18n!("locales", fallback = "en");
|
rust_i18n::i18n!("locales", fallback = "en");
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(name = "easytier-core", author, version = EASYTIER_VERSION , about, long_about = None)]
|
#[command(name = "easytier-web", author, version = EASYTIER_VERSION , about, long_about = None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[arg(short, long, default_value = "et.db", help = t!("cli.db").to_string())]
|
#[arg(short, long, default_value = "et.db", help = t!("cli.db").to_string())]
|
||||||
db: String,
|
db: String,
|
||||||
@@ -95,6 +95,7 @@ pub fn get_listener_by_url(l: &url::Url) -> Result<Box<dyn TunnelListener>, Erro
|
|||||||
Ok(match l.scheme() {
|
Ok(match l.scheme() {
|
||||||
"tcp" => Box::new(TcpTunnelListener::new(l.clone())),
|
"tcp" => Box::new(TcpTunnelListener::new(l.clone())),
|
||||||
"udp" => Box::new(UdpTunnelListener::new(l.clone())),
|
"udp" => Box::new(UdpTunnelListener::new(l.clone())),
|
||||||
|
"ws" => Box::new(WSTunnelListener::new(l.clone())),
|
||||||
_ => {
|
_ => {
|
||||||
return Err(Error::InvalidUrl(l.to_string()));
|
return Err(Error::InvalidUrl(l.to_string()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user