musl version

This commit is contained in:
alex 2026-03-20 16:19:54 +08:00
parent f8c213c8c7
commit 78351e0493
6 changed files with 500 additions and 265 deletions

View File

@ -1,5 +1,5 @@
[target.x86_64-unknown-linux-musl] [target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc" linker = "musl-gcc"
[target.aarch64-unknown-linux-gnu] [target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc" linker = "aarch64-linux-gnu-gcc"

734
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package] [package]
name = "punchnet" name = "punchnet"
version = "1.0.2" version = "1.0.3"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
@ -30,7 +30,7 @@ tracing = "0.1.40"
myactor = { git = "https://gitea.s5s8.com/rust/actor-rs.git" } myactor = { git = "https://gitea.s5s8.com/rust/actor-rs.git" }
bytes = "1.11.1" bytes = "1.11.1"
quinn = "0.11.9" quinn = "0.11.9"
rustls = "0.23.37" rustls = { version = "0.23.37", features = ["ring", "std"]}
rustls-pemfile = "2.2.0" rustls-pemfile = "2.2.0"
clap = { version = "4.5.60", features = ["derive", "env"] } clap = { version = "4.5.60", features = ["derive", "env"] }
rpassword = "7.4.0" rpassword = "7.4.0"

View File

@ -22,16 +22,23 @@ libtun-so-clang:
cd src/network && clang -fPIC -shared -o libtuntap.so tuntap.c && cd - cd src/network && clang -fPIC -shared -o libtuntap.so tuntap.c && cd -
libtun-so: libtun-so:
cd src/network && gcc -fPIC -shared -o libtuntap.so tuntap.c && cp libtuntap.so ../.. && cd - rm libtuntap.* && cd src/network && gcc -fPIC -shared -o libtuntap.so tuntap.c && cp libtuntap.so ../.. && cd -
libtun-so-aarch64: libtun-so-aarch64:
cd src/network && aarch64-linux-gnu-gcc -fPIC -shared -o libtuntap.so tuntap.c && cp libtuntap.so ../.. && cd - rm libtuntap.* && cd src/network && aarch64-linux-gnu-gcc -fPIC -shared -o libtuntap.so tuntap.c && cp libtuntap.so ../.. && cd -
pack: pack:
tar -czvf punchnet.tar.gz punchnet punchnet.service libtuntap.so install.sh tar -czvf punchnet.tar.gz punchnet punchnet.service libtuntap.so install.sh
libtun-musl:
rm libtuntap.* && touch libtuntap.so && cd src/network && musl-gcc -c tuntap.c -o libtuntap.o && ar rcs libtuntap.a libtuntap.o && cp libtuntap.a ../.. && cd -
deb-musl: libtun-musl
RUSTFLAGS="-L ." cargo deb --target x86_64-unknown-linux-musl --deb-revision="1-static"
deb: libtun-so deb: libtun-so
RUSTFLAGS="-L ." cargo deb RUSTFLAGS="-L ." cargo deb --deb-revision="1-dynamic"
deb-aarch64: libtun-so-aarch64 deb-aarch64: libtun-so-aarch64
RUSTFLAGS="-L ." cargo deb --target aarch64-unknown-linux-gnu RUSTFLAGS="-L ." cargo deb --target aarch64-unknown-linux-gnu

View File

@ -354,7 +354,7 @@ fn main() {
} }
} }
let should_daemonize = false; let should_daemonize = true;
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
if should_daemonize { if should_daemonize {

View File

@ -8,16 +8,16 @@
#include <string.h> #include <string.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef __linux__ // #ifdef __linux__
#include <linux/if.h> // #include <linux/if.h>
#include <linux/if_tun.h> // #include <linux/if_tun.h>
#else // #else
#include <net/if.h> #include <net/if.h>
#define IFF_TUN 0x0001 #define IFF_TUN 0x0001
#define IFF_TAP 0x0002 #define IFF_TAP 0x0002
#define IFF_NO_PI 0x1000 #define IFF_NO_PI 0x1000
#define TUNSETIFF _IOW('T', 202, int) #define TUNSETIFF _IOW('T', 202, int)
#endif // #endif
#include <sys/ioctl.h> #include <sys/ioctl.h>
/** /**