mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
refactor: handle quic proxy internally instead of use external udp port (#1743)
* deprecate quic_listen_port, add disable_relay_quic and enable_relay_foreign_network_quic * add set_src_modified to TcpProxyForWrappedSrcTrait * prioritize quic over kcp
This commit is contained in:
@@ -72,6 +72,8 @@ pub enum PacketType {
|
||||
ForeignNetworkPacket = 10,
|
||||
KcpSrc = 11,
|
||||
KcpDst = 12,
|
||||
QuicSrc = 16,
|
||||
QuicDst = 17,
|
||||
NoiseHandshakeMsg1 = 13,
|
||||
NoiseHandshakeMsg2 = 14,
|
||||
NoiseHandshakeMsg3 = 15,
|
||||
@@ -85,6 +87,7 @@ bitflags::bitflags! {
|
||||
const NO_PROXY = 0b0000_1000;
|
||||
const COMPRESSED = 0b0001_0000;
|
||||
const KCP_SRC_MODIFIED = 0b0010_0000;
|
||||
const QUIC_SRC_MODIFIED = 0b1000_0000;
|
||||
const NOT_SEND_TO_TUN = 0b0100_0000;
|
||||
|
||||
const _ = !0;
|
||||
@@ -206,6 +209,23 @@ impl PeerManagerHeader {
|
||||
.contains(PeerManagerHeaderFlags::KCP_SRC_MODIFIED)
|
||||
}
|
||||
|
||||
pub fn set_quic_src_modified(&mut self, modified: bool) -> &mut Self {
|
||||
let mut flags = PeerManagerHeaderFlags::from_bits(self.flags).unwrap();
|
||||
if modified {
|
||||
flags.insert(PeerManagerHeaderFlags::QUIC_SRC_MODIFIED);
|
||||
} else {
|
||||
flags.remove(PeerManagerHeaderFlags::QUIC_SRC_MODIFIED);
|
||||
}
|
||||
self.flags = flags.bits();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn is_quic_src_modified(&self) -> bool {
|
||||
PeerManagerHeaderFlags::from_bits(self.flags)
|
||||
.unwrap()
|
||||
.contains(PeerManagerHeaderFlags::QUIC_SRC_MODIFIED)
|
||||
}
|
||||
|
||||
pub fn set_not_send_to_tun(&mut self, not_send_to_tun: bool) -> &mut Self {
|
||||
let mut flags = PeerManagerHeaderFlags::from_bits(self.flags).unwrap();
|
||||
if not_send_to_tun {
|
||||
|
||||
@@ -26,12 +26,12 @@ pub fn transport_config() -> Arc<TransportConfig> {
|
||||
let mut config = TransportConfig::default();
|
||||
|
||||
config
|
||||
// .max_concurrent_bidi_streams(VarInt::MAX)
|
||||
.max_concurrent_bidi_streams(u8::MAX.into())
|
||||
.max_concurrent_uni_streams(0u8.into())
|
||||
.keep_alive_interval(Some(Duration::from_secs(5)))
|
||||
.initial_mtu(1200)
|
||||
.min_mtu(1200)
|
||||
.enable_segmentation_offload(false)
|
||||
.enable_segmentation_offload(true)
|
||||
.congestion_controller_factory(Arc::new(BbrConfig::default()));
|
||||
|
||||
Arc::new(config)
|
||||
|
||||
Reference in New Issue
Block a user