mirror of
https://github.com/dndx/phantun.git
synced 2025-09-16 04:04:29 +08:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
726ecac9cf | ||
|
2ef0a056be | ||
|
cb9dd3e931 | ||
|
7db7164193 | ||
|
def134d73b |
@@ -31,7 +31,7 @@ Table of Contents
|
|||||||
|
|
||||||
# Latest release
|
# Latest release
|
||||||
|
|
||||||
[v0.2.3](https://github.com/dndx/phantun/releases/tag/v0.2.3)
|
[v0.2.4](https://github.com/dndx/phantun/releases/tag/v0.2.4)
|
||||||
|
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "fake-tcp"
|
name = "fake-tcp"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Datong Sun <dndx@idndx.com>"]
|
authors = ["Datong Sun <dndx@idndx.com>"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
@@ -21,4 +21,4 @@ tokio = { version = "1.14", features = ["full"] }
|
|||||||
rand = { version = "0.8", features = ["small_rng"] }
|
rand = { version = "0.8", features = ["small_rng"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
internet-checksum = "0.2"
|
internet-checksum = "0.2"
|
||||||
dndx-fork-tokio-tun = "0.4"
|
tokio-tun = "0.5"
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#![cfg_attr(feature = "benchmark", feature(test))]
|
#![cfg_attr(feature = "benchmark", feature(test))]
|
||||||
|
|
||||||
pub mod packet;
|
pub mod packet;
|
||||||
extern crate dndx_fork_tokio_tun as tokio_tun;
|
|
||||||
|
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use log::{error, info, trace, warn};
|
use log::{error, info, trace, warn};
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "phantun"
|
name = "phantun"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Datong Sun <dndx@idndx.com>"]
|
authors = ["Datong Sun <dndx@idndx.com>"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
@@ -11,11 +11,11 @@ Transforms UDP stream into (fake) TCP streams that can go through
|
|||||||
Layer 3 & Layer 4 (NAPT) firewalls/NATs.
|
Layer 3 & Layer 4 (NAPT) firewalls/NATs.
|
||||||
"""
|
"""
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.34"
|
clap = { version = "3.0", features = ["cargo"] }
|
||||||
socket2 = { version = "0.4", features = ["all"] }
|
socket2 = { version = "0.4", features = ["all"] }
|
||||||
fake-tcp = "0.2.2"
|
fake-tcp = "0.2"
|
||||||
tokio = { version = "1.14", features = ["full"] }
|
tokio = { version = "1.14", features = ["full"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.4"
|
||||||
dndx-fork-tokio-tun = "0.4"
|
tokio-tun = "0.5"
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
extern crate dndx_fork_tokio_tun as tokio_tun;
|
|
||||||
|
|
||||||
use clap::{crate_version, App, Arg};
|
use clap::{crate_version, App, Arg};
|
||||||
use fake_tcp::packet::MAX_PACKET_LEN;
|
use fake_tcp::packet::MAX_PACKET_LEN;
|
||||||
use fake_tcp::{Socket, Stack};
|
use fake_tcp::{Socket, Stack};
|
||||||
@@ -44,8 +42,8 @@ async fn main() {
|
|||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.author("Datong Sun (github.com/dndx)")
|
.author("Datong Sun (github.com/dndx)")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("local")
|
Arg::new("local")
|
||||||
.short("l")
|
.short('l')
|
||||||
.long("local")
|
.long("local")
|
||||||
.required(true)
|
.required(true)
|
||||||
.value_name("IP:PORT")
|
.value_name("IP:PORT")
|
||||||
@@ -53,8 +51,8 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.short("r")
|
.short('r')
|
||||||
.long("remote")
|
.long("remote")
|
||||||
.required(true)
|
.required(true)
|
||||||
.value_name("IP or HOST NAME:PORT")
|
.value_name("IP or HOST NAME:PORT")
|
||||||
@@ -62,7 +60,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun")
|
Arg::new("tun")
|
||||||
.long("tun")
|
.long("tun")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("tunX")
|
.value_name("tunX")
|
||||||
@@ -71,7 +69,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun_local")
|
Arg::new("tun_local")
|
||||||
.long("tun-local")
|
.long("tun-local")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("IP")
|
.value_name("IP")
|
||||||
@@ -80,7 +78,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun_peer")
|
Arg::new("tun_peer")
|
||||||
.long("tun-peer")
|
.long("tun-peer")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("IP")
|
.value_name("IP")
|
||||||
@@ -101,12 +99,12 @@ async fn main() {
|
|||||||
let remote_addr = tokio::net::lookup_host(matches.value_of("remote").unwrap())
|
let remote_addr = tokio::net::lookup_host(matches.value_of("remote").unwrap())
|
||||||
.await
|
.await
|
||||||
.expect("bad remote address or host")
|
.expect("bad remote address or host")
|
||||||
.next()
|
.find(|addr| addr.is_ipv4())
|
||||||
.expect("unable to resolve remote host name");
|
.expect("unable to resolve remote host name or no valid A record was returned");
|
||||||
let remote_addr = if let SocketAddr::V4(addr) = remote_addr {
|
let remote_addr = if let SocketAddr::V4(addr) = remote_addr {
|
||||||
addr
|
addr
|
||||||
} else {
|
} else {
|
||||||
panic!("only IPv4 remote address is supported");
|
unreachable!();
|
||||||
};
|
};
|
||||||
info!("Remote address is: {}", remote_addr);
|
info!("Remote address is: {}", remote_addr);
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
extern crate dndx_fork_tokio_tun as tokio_tun;
|
|
||||||
|
|
||||||
use clap::{crate_version, App, Arg};
|
use clap::{crate_version, App, Arg};
|
||||||
use fake_tcp::packet::MAX_PACKET_LEN;
|
use fake_tcp::packet::MAX_PACKET_LEN;
|
||||||
use fake_tcp::Stack;
|
use fake_tcp::Stack;
|
||||||
@@ -18,8 +16,8 @@ async fn main() {
|
|||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.author("Datong Sun (github.com/dndx)")
|
.author("Datong Sun (github.com/dndx)")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("local")
|
Arg::new("local")
|
||||||
.short("l")
|
.short('l')
|
||||||
.long("local")
|
.long("local")
|
||||||
.required(true)
|
.required(true)
|
||||||
.value_name("PORT")
|
.value_name("PORT")
|
||||||
@@ -27,8 +25,8 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.short("r")
|
.short('r')
|
||||||
.long("remote")
|
.long("remote")
|
||||||
.required(true)
|
.required(true)
|
||||||
.value_name("IP or HOST NAME:PORT")
|
.value_name("IP or HOST NAME:PORT")
|
||||||
@@ -36,7 +34,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun")
|
Arg::new("tun")
|
||||||
.long("tun")
|
.long("tun")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("tunX")
|
.value_name("tunX")
|
||||||
@@ -45,7 +43,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun_local")
|
Arg::new("tun_local")
|
||||||
.long("tun-local")
|
.long("tun-local")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("IP")
|
.value_name("IP")
|
||||||
@@ -54,7 +52,7 @@ async fn main() {
|
|||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tun_peer")
|
Arg::new("tun_peer")
|
||||||
.long("tun-peer")
|
.long("tun-peer")
|
||||||
.required(false)
|
.required(false)
|
||||||
.value_name("IP")
|
.value_name("IP")
|
||||||
|
Reference in New Issue
Block a user