mirror of
https://github.com/dndx/phantun.git
synced 2025-10-15 18:25:36 +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
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
|
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -135,18 +135,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.45"
|
||||
version = "4.5.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
|
||||
checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.44"
|
||||
version = "4.5.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
|
||||
checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@@ -5,8 +5,7 @@ A lightweight and fast UDP to TCP obfuscator.
|
||||

|
||||

|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
# Table of Contents
|
||||
|
||||
* [Phantun](#phantun)
|
||||
* [Latest release](#latest-release)
|
||||
@@ -35,7 +34,7 @@ Table of Contents
|
||||
|
||||
# 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>
|
||||
<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-client /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 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
|
||||
if [ "$USE_IPTABLES_NFT_BACKEND" = 1 ]; then
|
||||
|
@@ -62,13 +62,11 @@ pub async fn udp_recv_pktinfo(
|
||||
buf: &mut [u8],
|
||||
) -> std::io::Result<(usize, SocketAddr, IpAddr)> {
|
||||
sock.async_io(Interest::READABLE, || {
|
||||
// according to documented struct definition in RFC 3542,
|
||||
// sizeof(in6_pktinfo) should always be larger than sizeof(in_pktinfo),
|
||||
// this assert just double checks that. The goal is to avoid
|
||||
// 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; cmsg_space::<nix::libc::in6_pktinfo>()];
|
||||
const CONTROL_MESSAGE_BUFFER_SIZE: usize = max_usize(
|
||||
cmsg_space::<nix::libc::in_pktinfo>(),
|
||||
cmsg_space::<nix::libc::in6_pktinfo>(),
|
||||
);
|
||||
let mut control_message_buffer = [0u8; CONTROL_MESSAGE_BUFFER_SIZE];
|
||||
let iov = &mut [std::io::IoSliceMut::new(buf)];
|
||||
let res = nix::sys::socket::recvmsg::<SockaddrStorage>(
|
||||
sock.as_raw_fd(),
|
||||
@@ -151,3 +149,7 @@ pub fn assign_ipv6_address(device_name: &str, local: Ipv6Addr, peer: Ipv6Addr) {
|
||||
.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