mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-16 09:36:14 -08:00
feat(mini): add compact native EasyTier client (#2479)
Add a native EasyTier proof-of-concept binary with TCP and UDP transports, TUN, UDP hole punching, AES-GCM, and a read-only RPC portal. Introduce a release-derived mini profile and musl linker policy so x86_64, big-endian MIPS, and little-endian MIPS stay below the strict 5,000,000-byte target without UPX.
This commit is contained in:
1 parent
1e40350c89
commit
d375d7e455
47 files changed
+1688
-302
No files matched your search
@@ -85,28 +85,6 @@ impl EventJournal {
|
||||
self.events.read().unwrap().iter().cloned().collect()
|
||||
}
|
||||
|
||||
pub(super) fn synchronize_config(
|
||||
&self,
|
||||
patch: &crate::proto::api::config::InstanceConfigPatch,
|
||||
) {
|
||||
if let Some(hostname) = &patch.hostname {
|
||||
self.global_ctx.set_hostname(hostname.clone());
|
||||
}
|
||||
if let Some(ipv4) = patch.ipv4.as_ref()
|
||||
&& !self.global_ctx.config.get_dhcp()
|
||||
{
|
||||
self.global_ctx.set_ipv4(Some((*ipv4).into()));
|
||||
}
|
||||
if let Some(ipv6) = patch.ipv6.as_ref() {
|
||||
self.global_ctx.set_ipv6(Some((*ipv6).into()));
|
||||
}
|
||||
if let Some(disable_relay_data) = patch.disable_relay_data {
|
||||
let mut flags = self.global_ctx.get_flags();
|
||||
flags.disable_relay_data = disable_relay_data;
|
||||
self.global_ctx.set_flags(flags);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn publish_config_patch(
|
||||
&self,
|
||||
patch: crate::proto::api::config::InstanceConfigPatch,
|
||||
|
||||
@@ -29,14 +29,21 @@ impl InstanceRuntimeHost for NativeInstanceRuntimeHost {
|
||||
self.management_events_snapshot()
|
||||
}
|
||||
|
||||
#[cfg(feature = "management")]
|
||||
fn synchronize_config(&self, patch: &crate::proto::api::config::InstanceConfigPatch) {
|
||||
self.event_journal.synchronize_config(patch);
|
||||
#[cfg(feature = "web-client")]
|
||||
fn synchronize_config(
|
||||
&self,
|
||||
patch: &crate::proto::api::config::InstanceConfigPatch,
|
||||
config: &easytier_core::config::runtime::CoreInstanceRuntimeConfig,
|
||||
) {
|
||||
self.synchronize_global_ctx_config(patch, config);
|
||||
}
|
||||
|
||||
#[cfg(feature = "management")]
|
||||
#[cfg(feature = "web-client")]
|
||||
fn publish_config_patch(&self, patch: crate::proto::api::config::InstanceConfigPatch) {
|
||||
#[cfg(feature = "management")]
|
||||
self.event_journal.publish_config_patch(patch);
|
||||
#[cfg(not(feature = "management"))]
|
||||
let _ = patch;
|
||||
}
|
||||
|
||||
fn attach_tun_fd(&self, fd: i32) -> anyhow::Result<()> {
|
||||
|
||||
@@ -5,10 +5,7 @@ use tokio_util::{sync::CancellationToken, task::AbortOnDropHandle};
|
||||
|
||||
use crate::common::global_ctx::ArcGlobalCtx;
|
||||
#[cfg(feature = "magic-dns")]
|
||||
use crate::{
|
||||
common::config::ConfigLoader as _,
|
||||
instance::dns_server::{MAGIC_DNS_FAKE_IP, runner::DnsRunner},
|
||||
};
|
||||
use crate::instance::dns_server::{MAGIC_DNS_FAKE_IP, runner::DnsRunner};
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct MagicDnsRuntime {
|
||||
@@ -30,7 +27,7 @@ impl MagicDnsRuntime {
|
||||
tun_dev: Option<String>,
|
||||
tun_ip: Ipv4Inet,
|
||||
) -> Self {
|
||||
let active = global_ctx.config.get_flags().accept_dns.then(|| {
|
||||
let active = global_ctx.get_flags().accept_dns.then(|| {
|
||||
let mut runner = DnsRunner::new(
|
||||
packet_plane,
|
||||
global_ctx,
|
||||
|
||||
@@ -17,7 +17,6 @@ use tokio_util::sync::CancellationToken;
|
||||
use super::{MagicDnsRuntime, tun_common::TunNicState};
|
||||
use crate::{
|
||||
common::{
|
||||
config::ConfigLoader as _,
|
||||
error::Error,
|
||||
global_ctx::{ArcGlobalCtx, GlobalCtxEvent},
|
||||
},
|
||||
@@ -133,7 +132,7 @@ impl NativeTunRuntime {
|
||||
|
||||
pub(super) async fn prepare(&self, packet_plane: Arc<CorePacketPlane>) -> anyhow::Result<()> {
|
||||
self.nic.drain().await;
|
||||
if !self.global_ctx.config.get_flags().no_tun {
|
||||
if !self.global_ctx.get_flags().no_tun {
|
||||
self.start_static_ip(packet_plane).await?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user