mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 09:09:17 +00:00
Merge branch 'main' into feat/dns-policy
This commit is contained in:
@@ -345,7 +345,7 @@ impl AclProcessor {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Sort by priority (higher priority first)
|
||||
rules.sort_by(|a, b| b.priority.cmp(&a.priority));
|
||||
rules.sort_by_key(|r| std::cmp::Reverse(r.priority));
|
||||
|
||||
match chain.chain_type() {
|
||||
ChainType::Inbound => inbound_rules.extend(rules),
|
||||
|
||||
@@ -16,7 +16,6 @@ use crate::{
|
||||
};
|
||||
use anyhow::Context;
|
||||
use base64::{Engine as _, prelude::BASE64_STANDARD};
|
||||
use cfg_if::cfg_if;
|
||||
use clap::ValueEnum;
|
||||
use clap::builder::PossibleValue;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -107,10 +106,9 @@ impl ValueEnum for EncryptionAlgorithm {
|
||||
#[allow(clippy::derivable_impls)]
|
||||
impl Default for EncryptionAlgorithm {
|
||||
fn default() -> Self {
|
||||
cfg_if! {
|
||||
if #[cfg(any(feature = "aes-gcm", feature = "wireguard", feature = "openssl-crypto"))] {
|
||||
EncryptionAlgorithm::AesGcm
|
||||
} else {
|
||||
cfg_select! {
|
||||
any(feature = "aes-gcm", feature = "wireguard", feature = "openssl-crypto") => EncryptionAlgorithm::AesGcm,
|
||||
_ => {
|
||||
crate::common::log::warn!("no AEAD encryption algorithm is available, using INSECURE XOR");
|
||||
EncryptionAlgorithm::Xor
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::common::get_logger_timer_rfc3339;
|
||||
use crate::common::tracing_rolling_appender::{FileAppenderWrapper, RollingFileAppenderBase};
|
||||
use crate::rpc_service::logger::{CURRENT_LOG_LEVEL, LOGGER_LEVEL_SENDER};
|
||||
use anyhow::Context;
|
||||
use cfg_if::cfg_if;
|
||||
use paste::paste;
|
||||
use std::io::IsTerminal;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
@@ -121,14 +120,13 @@ fn console_layers(default_level: Option<LevelFilter>) -> anyhow::Result<Vec<BoxL
|
||||
let (console_filter, _) =
|
||||
tracing_subscriber::reload::Layer::new(parse_env_filter(default_level)?);
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(test)] {
|
||||
let (stdout, stderr) = cfg_select! {
|
||||
test => {{
|
||||
let w = tracing_subscriber::fmt::TestWriter::new;
|
||||
let (stdout, stderr) = (w, w);
|
||||
} else {
|
||||
let (stdout, stderr) = (std::io::stdout, std::io::stderr);
|
||||
}
|
||||
}
|
||||
(w, w)
|
||||
}}
|
||||
_ => (std::io::stdout, std::io::stderr),
|
||||
};
|
||||
|
||||
let ansi = std::io::stderr().is_terminal() || cfg!(test);
|
||||
|
||||
|
||||
+12
-24
@@ -239,15 +239,11 @@ impl StunClient {
|
||||
let mut mapped_addr = None;
|
||||
for x in msg.attributes() {
|
||||
match x {
|
||||
Attribute::MappedAddress(addr) => {
|
||||
if mapped_addr.is_none() {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::MappedAddress(addr) if mapped_addr.is_none() => {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::XorMappedAddress(addr) => {
|
||||
if mapped_addr.is_none() {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::XorMappedAddress(addr) if mapped_addr.is_none() => {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -259,15 +255,11 @@ impl StunClient {
|
||||
let mut changed_addr = None;
|
||||
for x in msg.attributes() {
|
||||
match x {
|
||||
Attribute::OtherAddress(m) => {
|
||||
if changed_addr.is_none() {
|
||||
let _ = changed_addr.insert(m.address());
|
||||
}
|
||||
Attribute::OtherAddress(m) if changed_addr.is_none() => {
|
||||
let _ = changed_addr.insert(m.address());
|
||||
}
|
||||
Attribute::ChangedAddress(m) => {
|
||||
if changed_addr.is_none() {
|
||||
let _ = changed_addr.insert(m.address());
|
||||
}
|
||||
Attribute::ChangedAddress(m) if changed_addr.is_none() => {
|
||||
let _ = changed_addr.insert(m.address());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -714,15 +706,11 @@ impl TcpStunClient {
|
||||
let mut mapped_addr = None;
|
||||
for x in msg.attributes() {
|
||||
match x {
|
||||
Attribute::MappedAddress(addr) => {
|
||||
if mapped_addr.is_none() {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::MappedAddress(addr) if mapped_addr.is_none() => {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::XorMappedAddress(addr) => {
|
||||
if mapped_addr.is_none() {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
Attribute::XorMappedAddress(addr) if mapped_addr.is_none() => {
|
||||
let _ = mapped_addr.insert(addr.address());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user