mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 17:59:11 +00:00
feat: separate zstd and faketcp into features (#1861)
* feat: separate faketcp into a feature * fix: no need to initialize out_len * feat: separate zstd into a feature * clippy: remove unnecessary cast, because for unix size_t always equals usize
This commit is contained in:
+51
-13
@@ -94,7 +94,13 @@ tun = { package = "tun-easytier", git = "https://github.com/EasyTier/rust-tun",
|
|||||||
"async",
|
"async",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
# for net ns
|
# for net ns
|
||||||
nix = { version = "0.29.0", features = ["sched", "socket", "ioctl", "net", "fs"] }
|
nix = { version = "0.29.0", features = [
|
||||||
|
"sched",
|
||||||
|
"socket",
|
||||||
|
"ioctl",
|
||||||
|
"net",
|
||||||
|
"fs",
|
||||||
|
] }
|
||||||
|
|
||||||
uuid = { version = "1.5.0", features = [
|
uuid = { version = "1.5.0", features = [
|
||||||
"v4",
|
"v4",
|
||||||
@@ -202,7 +208,7 @@ async-ringbuf = "0.3.1"
|
|||||||
|
|
||||||
service-manager = { git = "https://github.com/EasyTier/service-manager-rs.git", branch = "main" }
|
service-manager = { git = "https://github.com/EasyTier/service-manager-rs.git", branch = "main" }
|
||||||
|
|
||||||
zstd = { version = "0.13" }
|
zstd = { version = "0.13", optional = true }
|
||||||
|
|
||||||
kcp-sys = { git = "https://github.com/EasyTier/kcp-sys", rev = "94964794caaed5d388463137da59b97499619e5f", optional = true }
|
kcp-sys = { git = "https://github.com/EasyTier/kcp-sys", rev = "94964794caaed5d388463137da59b97499619e5f", optional = true }
|
||||||
|
|
||||||
@@ -221,7 +227,9 @@ hickory-proto = "0.25.2"
|
|||||||
|
|
||||||
# for magic dns
|
# for magic dns
|
||||||
hickory-client = { version = "0.25.2", optional = true }
|
hickory-client = { version = "0.25.2", optional = true }
|
||||||
hickory-server = { version = "0.25.2", features = ["resolver"], optional = true }
|
hickory-server = { version = "0.25.2", features = [
|
||||||
|
"resolver",
|
||||||
|
], optional = true }
|
||||||
|
|
||||||
derive_builder = "0.20.2"
|
derive_builder = "0.20.2"
|
||||||
humantime-serde = "1.1.1"
|
humantime-serde = "1.1.1"
|
||||||
@@ -232,7 +240,7 @@ sha2 = "0.10.8"
|
|||||||
shellexpand = "3.1.1"
|
shellexpand = "3.1.1"
|
||||||
|
|
||||||
# for fake tcp
|
# for fake tcp
|
||||||
flume = "0.12"
|
flume = { version = "0.12", optional = true }
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "freebsd"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "freebsd"))'.dependencies]
|
||||||
@@ -249,7 +257,9 @@ dbus = { version = "0.9.7", features = ["vendored"] }
|
|||||||
which = "7.0.3"
|
which = "7.0.3"
|
||||||
|
|
||||||
[target.'cfg(all(windows, any(target_arch = "x86_64", target_arch = "x86")))'.dependencies]
|
[target.'cfg(all(windows, any(target_arch = "x86_64", target_arch = "x86")))'.dependencies]
|
||||||
windivert = { git = "https://github.com/EasyTier/windivert-rust.git", rev = "adcc56d1550f7b5377ec2b3429f413ee24a77375", features = ["static"] }
|
windivert = { git = "https://github.com/EasyTier/windivert-rust.git", rev = "adcc56d1550f7b5377ec2b3429f413ee24a77375", features = [
|
||||||
|
"static",
|
||||||
|
] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows = { version = "0.52.0", features = [
|
windows = { version = "0.52.0", features = [
|
||||||
@@ -269,16 +279,16 @@ windows-sys = { version = "0.52", features = [
|
|||||||
"Win32_NetworkManagement_IpHelper",
|
"Win32_NetworkManagement_IpHelper",
|
||||||
"Win32_NetworkManagement_Ndis",
|
"Win32_NetworkManagement_Ndis",
|
||||||
"Win32_Networking_WinSock",
|
"Win32_Networking_WinSock",
|
||||||
"Win32_Foundation"
|
"Win32_Foundation",
|
||||||
] }
|
] }
|
||||||
winapi = { version = "0.3.9", features = ["impl-default"] }
|
winapi = { version = "0.3.9", features = ["impl-default"] }
|
||||||
|
|
||||||
[target.'cfg(not(windows))'.dependencies]
|
[target.'cfg(not(windows))'.dependencies]
|
||||||
jemallocator = { package = "tikv-jemallocator", version = "0.6.0", optional = true, features = [
|
jemallocator = { package = "tikv-jemallocator", version = "0.6.0", optional = true, features = [
|
||||||
"unprefixed_malloc_on_supported_platforms"
|
"unprefixed_malloc_on_supported_platforms",
|
||||||
] }
|
] }
|
||||||
jemalloc-ctl = { package = "tikv-jemalloc-ctl", version = "0.6.0", optional = true, features = [
|
jemalloc-ctl = { package = "tikv-jemalloc-ctl", version = "0.6.0", optional = true, features = [
|
||||||
"use_std"
|
"use_std",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
@@ -296,7 +306,9 @@ tonic-build = "0.12"
|
|||||||
globwalk = "0.8.1"
|
globwalk = "0.8.1"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
prost-build = "0.13.2"
|
prost-build = "0.13.2"
|
||||||
easytier-rpc-build = { path = "../easytier-rpc-build", features = [ "internal-namespace" ] }
|
easytier-rpc-build = { path = "../easytier-rpc-build", features = [
|
||||||
|
"internal-namespace",
|
||||||
|
] }
|
||||||
prost-reflect-build = { version = "0.14.0" }
|
prost-reflect-build = { version = "0.14.0" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.build-dependencies]
|
[target.'cfg(windows)'.build-dependencies]
|
||||||
@@ -305,10 +317,14 @@ zip = "4.0.0"
|
|||||||
|
|
||||||
# enable thunk-rs when compiling for x86_64 or i686 windows
|
# enable thunk-rs when compiling for x86_64 or i686 windows
|
||||||
[target.x86_64-pc-windows-msvc.build-dependencies]
|
[target.x86_64-pc-windows-msvc.build-dependencies]
|
||||||
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] }
|
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = [
|
||||||
|
"win7",
|
||||||
|
] }
|
||||||
|
|
||||||
[target.i686-pc-windows-msvc.build-dependencies]
|
[target.i686-pc-windows-msvc.build-dependencies]
|
||||||
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] }
|
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = [
|
||||||
|
"win7",
|
||||||
|
] }
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
@@ -324,7 +340,18 @@ tokio-socks = "0.5.2"
|
|||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["wireguard", "websocket", "smoltcp", "tun", "socks5", "kcp", "quic", "magic-dns"]
|
default = [
|
||||||
|
"wireguard",
|
||||||
|
"websocket",
|
||||||
|
"smoltcp",
|
||||||
|
"tun",
|
||||||
|
"socks5",
|
||||||
|
"kcp",
|
||||||
|
"quic",
|
||||||
|
"faketcp",
|
||||||
|
"magic-dns",
|
||||||
|
"zstd",
|
||||||
|
]
|
||||||
full = [
|
full = [
|
||||||
"websocket",
|
"websocket",
|
||||||
"wireguard",
|
"wireguard",
|
||||||
@@ -333,8 +360,11 @@ full = [
|
|||||||
"smoltcp",
|
"smoltcp",
|
||||||
"tun",
|
"tun",
|
||||||
"socks5",
|
"socks5",
|
||||||
|
"kcp",
|
||||||
"quic",
|
"quic",
|
||||||
|
"faketcp",
|
||||||
"magic-dns",
|
"magic-dns",
|
||||||
|
"zstd",
|
||||||
]
|
]
|
||||||
wireguard = ["dep:boringtun", "dep:ring"]
|
wireguard = ["dep:boringtun", "dep:ring"]
|
||||||
quic = ["dep:quinn", "dep:quinn-plaintext", "dep:rustls", "dep:rcgen"]
|
quic = ["dep:quinn", "dep:quinn-plaintext", "dep:rustls", "dep:rcgen"]
|
||||||
@@ -353,6 +383,14 @@ websocket = [
|
|||||||
smoltcp = ["dep:smoltcp"]
|
smoltcp = ["dep:smoltcp"]
|
||||||
socks5 = ["smoltcp"]
|
socks5 = ["smoltcp"]
|
||||||
jemalloc = ["dep:jemallocator", "dep:jemalloc-sys"]
|
jemalloc = ["dep:jemallocator", "dep:jemalloc-sys"]
|
||||||
jemalloc-prof = ["jemalloc", "dep:jemalloc-ctl", "jemalloc-ctl/stats", "jemalloc-sys/profiling", "jemalloc-sys/stats"]
|
jemalloc-prof = [
|
||||||
|
"jemalloc",
|
||||||
|
"dep:jemalloc-ctl",
|
||||||
|
"jemalloc-ctl/stats",
|
||||||
|
"jemalloc-sys/profiling",
|
||||||
|
"jemalloc-sys/stats",
|
||||||
|
]
|
||||||
tracing = ["tokio/tracing", "dep:console-subscriber"]
|
tracing = ["tokio/tracing", "dep:console-subscriber"]
|
||||||
magic-dns = ["dep:hickory-client", "dep:hickory-server"]
|
magic-dns = ["dep:hickory-client", "dep:hickory-server"]
|
||||||
|
faketcp = ["dep:flume"]
|
||||||
|
zstd = ["dep:zstd"]
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
|
#[cfg(feature = "zstd")]
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
use zstd::bulk;
|
use zstd::bulk;
|
||||||
|
|
||||||
use zerocopy::{AsBytes as _, FromBytes as _};
|
use zerocopy::{AsBytes as _, FromBytes as _};
|
||||||
@@ -38,6 +42,7 @@ impl DefaultCompressor {
|
|||||||
compress_algo: CompressorAlgo,
|
compress_algo: CompressorAlgo,
|
||||||
) -> Result<Vec<u8>, Error> {
|
) -> Result<Vec<u8>, Error> {
|
||||||
match compress_algo {
|
match compress_algo {
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
CompressorAlgo::ZstdDefault => CTX_MAP.with(|map_cell| {
|
CompressorAlgo::ZstdDefault => CTX_MAP.with(|map_cell| {
|
||||||
let map = map_cell.borrow();
|
let map = map_cell.borrow();
|
||||||
let mut ctx_entry = map.entry(compress_algo).or_default();
|
let mut ctx_entry = map.entry(compress_algo).or_default();
|
||||||
@@ -58,6 +63,7 @@ impl DefaultCompressor {
|
|||||||
compress_algo: CompressorAlgo,
|
compress_algo: CompressorAlgo,
|
||||||
) -> Result<Vec<u8>, Error> {
|
) -> Result<Vec<u8>, Error> {
|
||||||
match compress_algo {
|
match compress_algo {
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
CompressorAlgo::ZstdDefault => DCTX_MAP.with(|map_cell| {
|
CompressorAlgo::ZstdDefault => DCTX_MAP.with(|map_cell| {
|
||||||
let map = map_cell.borrow();
|
let map = map_cell.borrow();
|
||||||
let mut ctx_entry = map.entry(compress_algo).or_default();
|
let mut ctx_entry = map.entry(compress_algo).or_default();
|
||||||
@@ -169,12 +175,13 @@ impl Compressor for DefaultCompressor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static CTX_MAP: RefCell<DashMap<CompressorAlgo, bulk::Compressor<'static>>> = RefCell::new(DashMap::new());
|
static CTX_MAP: RefCell<DashMap<CompressorAlgo, bulk::Compressor<'static>>> = RefCell::new(DashMap::new());
|
||||||
static DCTX_MAP: RefCell<DashMap<CompressorAlgo, bulk::Decompressor<'static>>> = RefCell::new(DashMap::new());
|
static DCTX_MAP: RefCell<DashMap<CompressorAlgo, bulk::Decompressor<'static>>> = RefCell::new(DashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, feature = "zstd"))]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ use std::{
|
|||||||
|
|
||||||
use http_connector::HttpTunnelConnector;
|
use http_connector::HttpTunnelConnector;
|
||||||
|
|
||||||
|
#[cfg(feature = "faketcp")]
|
||||||
|
use crate::tunnel::fake_tcp::FakeTcpTunnelConnector;
|
||||||
#[cfg(feature = "quic")]
|
#[cfg(feature = "quic")]
|
||||||
use crate::tunnel::quic::QUICTunnelConnector;
|
use crate::tunnel::quic::QUICTunnelConnector;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@@ -14,9 +16,8 @@ use crate::tunnel::wireguard::{WgConfig, WgTunnelConnector};
|
|||||||
use crate::{
|
use crate::{
|
||||||
common::{error::Error, global_ctx::ArcGlobalCtx, idn, network::IPCollector},
|
common::{error::Error, global_ctx::ArcGlobalCtx, idn, network::IPCollector},
|
||||||
tunnel::{
|
tunnel::{
|
||||||
check_scheme_and_get_socket_addr, fake_tcp::FakeTcpTunnelConnector,
|
check_scheme_and_get_socket_addr, ring::RingTunnelConnector, tcp::TcpTunnelConnector,
|
||||||
ring::RingTunnelConnector, tcp::TcpTunnelConnector, udp::UdpTunnelConnector, IpVersion,
|
udp::UdpTunnelConnector, IpVersion, TunnelConnector,
|
||||||
TunnelConnector,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -165,6 +166,7 @@ pub async fn create_connector_by_url(
|
|||||||
let connector = dns_connector::DNSTunnelConnector::new(url, global_ctx.clone());
|
let connector = dns_connector::DNSTunnelConnector::new(url, global_ctx.clone());
|
||||||
Box::new(connector)
|
Box::new(connector)
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "faketcp")]
|
||||||
"faketcp" => {
|
"faketcp" => {
|
||||||
let dst_addr =
|
let dst_addr =
|
||||||
check_scheme_and_get_socket_addr::<SocketAddr>(&url, "faketcp", ip_version).await?;
|
check_scheme_and_get_socket_addr::<SocketAddr>(&url, "faketcp", ip_version).await?;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ use anyhow::Context;
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
|
|
||||||
|
#[cfg(feature = "faketcp")]
|
||||||
|
use crate::tunnel::fake_tcp::FakeTcpTunnelListener;
|
||||||
#[cfg(feature = "quic")]
|
#[cfg(feature = "quic")]
|
||||||
use crate::tunnel::quic::QUICTunnelListener;
|
use crate::tunnel::quic::QUICTunnelListener;
|
||||||
#[cfg(feature = "wireguard")]
|
#[cfg(feature = "wireguard")]
|
||||||
@@ -21,8 +23,8 @@ use crate::{
|
|||||||
},
|
},
|
||||||
peers::peer_manager::PeerManager,
|
peers::peer_manager::PeerManager,
|
||||||
tunnel::{
|
tunnel::{
|
||||||
fake_tcp::FakeTcpTunnelListener, ring::RingTunnelListener, tcp::TcpTunnelListener,
|
ring::RingTunnelListener, tcp::TcpTunnelListener, udp::UdpTunnelListener, Tunnel,
|
||||||
udp::UdpTunnelListener, Tunnel, TunnelListener,
|
TunnelListener,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,6 +51,7 @@ pub fn get_listener_by_url(
|
|||||||
use crate::tunnel::websocket::WSTunnelListener;
|
use crate::tunnel::websocket::WSTunnelListener;
|
||||||
Box::new(WSTunnelListener::new(l.clone()))
|
Box::new(WSTunnelListener::new(l.clone()))
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "faketcp")]
|
||||||
"faketcp" => Box::new(FakeTcpTunnelListener::new(l.clone())),
|
"faketcp" => Box::new(FakeTcpTunnelListener::new(l.clone())),
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
"unix" => {
|
"unix" => {
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ impl TryFrom<CompressionAlgoPb> for CompressorAlgo {
|
|||||||
|
|
||||||
fn try_from(value: CompressionAlgoPb) -> Result<Self, Self::Error> {
|
fn try_from(value: CompressionAlgoPb) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
CompressionAlgoPb::Zstd => Ok(CompressorAlgo::ZstdDefault),
|
CompressionAlgoPb::Zstd => Ok(CompressorAlgo::ZstdDefault),
|
||||||
CompressionAlgoPb::None => Ok(CompressorAlgo::None),
|
CompressionAlgoPb::None => Ok(CompressorAlgo::None),
|
||||||
_ => Err(anyhow::anyhow!("Invalid CompressionAlgoPb")),
|
_ => Err(anyhow::anyhow!("Invalid CompressionAlgoPb")),
|
||||||
@@ -342,6 +343,7 @@ impl TryFrom<CompressorAlgo> for CompressionAlgoPb {
|
|||||||
|
|
||||||
fn try_from(value: CompressorAlgo) -> Result<Self, Self::Error> {
|
fn try_from(value: CompressorAlgo) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
CompressorAlgo::ZstdDefault => Ok(CompressionAlgoPb::Zstd),
|
CompressorAlgo::ZstdDefault => Ok(CompressionAlgoPb::Zstd),
|
||||||
CompressorAlgo::None => Ok(CompressionAlgoPb::None),
|
CompressorAlgo::None => Ok(CompressionAlgoPb::None),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -716,7 +716,7 @@ fn open_bpf_device() -> io::Result<OwnedFd> {
|
|||||||
|
|
||||||
fn set_ifreq_name(ifr: &mut libc::ifreq, interface_name: &str) -> io::Result<()> {
|
fn set_ifreq_name(ifr: &mut libc::ifreq, interface_name: &str) -> io::Result<()> {
|
||||||
let bytes = interface_name.as_bytes();
|
let bytes = interface_name.as_bytes();
|
||||||
let ifnamsiz = libc::IFNAMSIZ as usize;
|
let ifnamsiz = libc::IFNAMSIZ;
|
||||||
if bytes.len() >= ifnamsiz {
|
if bytes.len() >= ifnamsiz {
|
||||||
return Err(io::Error::new(
|
return Err(io::Error::new(
|
||||||
io::ErrorKind::InvalidInput,
|
io::ErrorKind::InvalidInput,
|
||||||
@@ -932,7 +932,7 @@ impl MacosBpfTun {
|
|||||||
|
|
||||||
let pkt_start = off + pkt_range.start;
|
let pkt_start = off + pkt_range.start;
|
||||||
let pkt_end = off + pkt_range.end;
|
let pkt_end = off + pkt_range.end;
|
||||||
let shift = (pkt_range.start as usize).saturating_sub(hdr_len as usize);
|
let shift = pkt_range.start.saturating_sub(hdr_len as usize);
|
||||||
if shift != 0 && shifted_record_logs_left > 0 {
|
if shift != 0 && shifted_record_logs_left > 0 {
|
||||||
shifted_record_logs_left -= 1;
|
shifted_record_logs_left -= 1;
|
||||||
warn!(
|
warn!(
|
||||||
@@ -1039,7 +1039,7 @@ impl stack::Tun for MacosBpfTun {
|
|||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut out_len = 0usize;
|
let mut out_len: usize;
|
||||||
let res = match self.link_type {
|
let res = match self.link_type {
|
||||||
LinkType::En10Mb => {
|
LinkType::En10Mb => {
|
||||||
out_len = packet.len();
|
out_len = packet.len();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use self::packet_def::ZCPacket;
|
|||||||
|
|
||||||
pub mod buf;
|
pub mod buf;
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod fake_tcp;
|
|
||||||
pub mod filter;
|
pub mod filter;
|
||||||
pub mod mpsc;
|
pub mod mpsc;
|
||||||
pub mod packet_def;
|
pub mod packet_def;
|
||||||
@@ -33,6 +32,9 @@ pub const PROTO_PORT_OFFSET: &[(&str, u16)] = &[
|
|||||||
("faketcp", 3),
|
("faketcp", 3),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[cfg(feature = "faketcp")]
|
||||||
|
pub mod fake_tcp;
|
||||||
|
|
||||||
#[cfg(feature = "wireguard")]
|
#[cfg(feature = "wireguard")]
|
||||||
pub mod wireguard;
|
pub mod wireguard;
|
||||||
|
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ pub const AES_GCM_ENCRYPTION_RESERVED: usize = std::mem::size_of::<AesGcmTail>()
|
|||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum CompressorAlgo {
|
pub enum CompressorAlgo {
|
||||||
None = 0,
|
None = 0,
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
ZstdDefault = 1,
|
ZstdDefault = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +302,7 @@ pub const COMPRESSOR_TAIL_SIZE: usize = std::mem::size_of::<CompressorTail>();
|
|||||||
impl CompressorTail {
|
impl CompressorTail {
|
||||||
pub fn get_algo(&self) -> Option<CompressorAlgo> {
|
pub fn get_algo(&self) -> Option<CompressorAlgo> {
|
||||||
match self.algo {
|
match self.algo {
|
||||||
|
#[cfg(feature = "zstd")]
|
||||||
1 => Some(CompressorAlgo::ZstdDefault),
|
1 => Some(CompressorAlgo::ZstdDefault),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user