mirror of
https://github.com/dndx/phantun.git
synced 2025-10-16 02:35:35 +08:00
Compare commits
5 Commits
v0.8.1
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
67cb36c26f | ||
|
7f7da10b1b | ||
|
9d74a6bfeb | ||
|
9bdfd76819 | ||
|
d1c18c64f3 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -64,7 +64,7 @@ jobs:
|
|||||||
- mipsel-unknown-linux-musl
|
- mipsel-unknown-linux-musl
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -135,18 +135,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.45"
|
version = "4.5.49"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
|
checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.44"
|
version = "4.5.49"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
|
checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
@@ -5,8 +5,7 @@ A lightweight and fast UDP to TCP obfuscator.
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
Table of Contents
|
# Table of Contents
|
||||||
=================
|
|
||||||
|
|
||||||
* [Phantun](#phantun)
|
* [Phantun](#phantun)
|
||||||
* [Latest release](#latest-release)
|
* [Latest release](#latest-release)
|
||||||
@@ -35,7 +34,7 @@ Table of Contents
|
|||||||
|
|
||||||
# Latest release
|
# Latest release
|
||||||
|
|
||||||
[v0.8.0](https://github.com/dndx/phantun/releases/tag/v0.8.0)
|
[v0.8.1](https://github.com/dndx/phantun/releases/tag/v0.8.1)
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>MIPS architecture support for Phantun</summary>
|
<summary>MIPS architecture support for Phantun</summary>
|
||||||
|
@@ -25,6 +25,10 @@ FROM debian:latest
|
|||||||
COPY --from=builder /usr/local/bin/phantun-server /usr/local/bin/
|
COPY --from=builder /usr/local/bin/phantun-server /usr/local/bin/
|
||||||
COPY --from=builder /usr/local/bin/phantun-client /usr/local/bin/
|
COPY --from=builder /usr/local/bin/phantun-client /usr/local/bin/
|
||||||
COPY docker/phantun.sh /usr/local/bin/
|
COPY docker/phantun.sh /usr/local/bin/
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
iproute2 \
|
||||||
|
iptables \
|
||||||
|
procps
|
||||||
|
|
||||||
ENV USE_IPTABLES_NFT_BACKEND=0
|
ENV USE_IPTABLES_NFT_BACKEND=0
|
||||||
ENV RUST_LOG=INFO
|
ENV RUST_LOG=INFO
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# alias settings must be global, and must be defined before the function being called with the alias
|
# alias settings must be global, and must be defined before the function being called with the alias
|
||||||
if [ "$USE_IPTABLES_NFT_BACKEND" = 1 ]; then
|
if [ "$USE_IPTABLES_NFT_BACKEND" = 1 ]; then
|
||||||
@@ -70,17 +70,17 @@ _is_ipv4_only() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_get_tun_from_args() {
|
_get_tun_from_args() {
|
||||||
local tun=$(echo "$@" | awk -F '--tun' '{print $2}' | awk '{print $1}')
|
local tun=$(echo "$@" | awk -F '--tun ' '{print $2}' | awk '{print $1}')
|
||||||
echo ${tun:=tun0}
|
echo ${tun:=tun0}
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_peer_from_args() {
|
_get_peer_from_args() {
|
||||||
local peer=$(echo "$@" | awk -F '--tun-peer' '{print $2}' | awk '{print $1}')
|
local peer=$(echo "$@" | awk -F '--tun-peer ' '{print $2}' | awk '{print $1}')
|
||||||
_is_server_mode "$1" && echo ${peer:=192.168.201.2} || echo ${peer:=192.168.200.2}
|
_is_server_mode "$1" && echo ${peer:=192.168.201.2} || echo ${peer:=192.168.200.2}
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_peer6_from_args() {
|
_get_peer6_from_args() {
|
||||||
local peer=$(echo "$@" | awk -F '--tun-peer6' '{print $2}' | awk '{print $1}')
|
local peer=$(echo "$@" | awk -F '--tun-peer6 ' '{print $2}' | awk '{print $1}')
|
||||||
_is_server_mode "$1" && echo ${peer:=fcc9::2} || echo ${peer:=fcc8::2}
|
_is_server_mode "$1" && echo ${peer:=fcc9::2} || echo ${peer:=fcc8::2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,13 +62,11 @@ pub async fn udp_recv_pktinfo(
|
|||||||
buf: &mut [u8],
|
buf: &mut [u8],
|
||||||
) -> std::io::Result<(usize, SocketAddr, IpAddr)> {
|
) -> std::io::Result<(usize, SocketAddr, IpAddr)> {
|
||||||
sock.async_io(Interest::READABLE, || {
|
sock.async_io(Interest::READABLE, || {
|
||||||
// according to documented struct definition in RFC 3542,
|
const CONTROL_MESSAGE_BUFFER_SIZE: usize = max_usize(
|
||||||
// sizeof(in6_pktinfo) should always be larger than sizeof(in_pktinfo),
|
cmsg_space::<nix::libc::in_pktinfo>(),
|
||||||
// this assert just double checks that. The goal is to avoid
|
cmsg_space::<nix::libc::in6_pktinfo>(),
|
||||||
// a heap allocation with Vec at runtime.
|
);
|
||||||
assert!(cmsg_space::<nix::libc::in6_pktinfo>() >= cmsg_space::<nix::libc::in_pktinfo>());
|
let mut control_message_buffer = [0u8; CONTROL_MESSAGE_BUFFER_SIZE];
|
||||||
|
|
||||||
let mut control_message_buffer = [0u8; cmsg_space::<nix::libc::in6_pktinfo>()];
|
|
||||||
let iov = &mut [std::io::IoSliceMut::new(buf)];
|
let iov = &mut [std::io::IoSliceMut::new(buf)];
|
||||||
let res = nix::sys::socket::recvmsg::<SockaddrStorage>(
|
let res = nix::sys::socket::recvmsg::<SockaddrStorage>(
|
||||||
sock.as_raw_fd(),
|
sock.as_raw_fd(),
|
||||||
@@ -151,3 +149,7 @@ pub fn assign_ipv6_address(device_name: &str, local: Ipv6Addr, peer: Ipv6Addr) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
rtnl.send(&nl_header).unwrap();
|
rtnl.send(&nl_header).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fn max_usize(a: usize, b: usize) -> usize {
|
||||||
|
if a > b { a } else { b }
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user