mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
support quic proxy (#993)
QUIC proxy works like kcp proxy, it can proxy TCP streams and transfer data with QUIC. QUIC has better congestion algorithm (BBR) for network with both high loss rate and high bandwidth. QUIC proxy can be enabled by passing `--enable-quic-proxy` to easytier in the client side. The proxy status can be viewed by `easytier-cli proxy`.
This commit is contained in:
@@ -81,6 +81,7 @@ bitflags::bitflags! {
|
||||
const EXIT_NODE = 0b0000_0100;
|
||||
const NO_PROXY = 0b0000_1000;
|
||||
const COMPRESSED = 0b0001_0000;
|
||||
const KCP_SRC_MODIFIED = 0b0010_0000;
|
||||
|
||||
const _ = !0;
|
||||
}
|
||||
@@ -183,6 +184,23 @@ impl PeerManagerHeader {
|
||||
self.flags = flags.bits();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_kcp_src_modified(&mut self, modified: bool) -> &mut Self {
|
||||
let mut flags = PeerManagerHeaderFlags::from_bits(self.flags).unwrap();
|
||||
if modified {
|
||||
flags.insert(PeerManagerHeaderFlags::KCP_SRC_MODIFIED);
|
||||
} else {
|
||||
flags.remove(PeerManagerHeaderFlags::KCP_SRC_MODIFIED);
|
||||
}
|
||||
self.flags = flags.bits();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn is_kcp_src_modified(&self) -> bool {
|
||||
PeerManagerHeaderFlags::from_bits(self.flags)
|
||||
.unwrap()
|
||||
.contains(PeerManagerHeaderFlags::KCP_SRC_MODIFIED)
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C, packed)]
|
||||
|
||||
@@ -17,7 +17,7 @@ use super::{
|
||||
IpVersion, Tunnel, TunnelConnector, TunnelError, TunnelListener,
|
||||
};
|
||||
|
||||
fn configure_client() -> ClientConfig {
|
||||
pub fn configure_client() -> ClientConfig {
|
||||
ClientConfig::new(Arc::new(
|
||||
QuicClientConfig::try_from(get_insecure_tls_client_config()).unwrap(),
|
||||
))
|
||||
@@ -38,7 +38,7 @@ pub fn make_server_endpoint(bind_addr: SocketAddr) -> Result<(Endpoint, Vec<u8>)
|
||||
}
|
||||
|
||||
/// Returns default server configuration along with its certificate.
|
||||
fn configure_server() -> Result<(ServerConfig, Vec<u8>), Box<dyn Error>> {
|
||||
pub fn configure_server() -> Result<(ServerConfig, Vec<u8>), Box<dyn Error>> {
|
||||
let (certs, key) = get_insecure_tls_cert();
|
||||
|
||||
let mut server_config = ServerConfig::with_single_cert(certs.clone(), key.into())?;
|
||||
|
||||
Reference in New Issue
Block a user