Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions fake-tcp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fake-tcp"
version = "0.5.0"
version = "0.5.5"
edition = "2021"
authors = ["Datong Sun <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand All @@ -15,11 +15,11 @@ packet oriented tunneling with minimum overhead.
benchmark = []

[dependencies]
bytes = "1"
pnet = "0.34"
tokio = { version = "1.14", features = ["full"] }
rand = { version = "0.8", features = ["small_rng"] }
log = "0.4"
internet-checksum = "0.2"
tokio-tun = "0.11"
flume = "0.11"
bytes = "1.4.0"
pnet = "0.34.0"
tokio = { version = "1.28.0", features = ["full"] }
rand = { version = "0.8.5", features = ["small_rng"] }
log = "0.4.17"
internet-checksum = "0.2.1"
tokio-tun = "0.11.2"
flume ="0.11.0"
25 changes: 13 additions & 12 deletions phantun/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "phantun"
version = "0.6.0"
version = "0.6.5"
edition = "2021"
authors = ["Datong Sun <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand All @@ -11,14 +11,15 @@ Transforms UDP stream into (fake) TCP streams that can go through
Layer 3 & Layer 4 (NAPT) firewalls/NATs.
"""
[dependencies]
clap = { version = "4.0", features = ["cargo"] }
socket2 = { version = "0.5", features = ["all"] }
fake-tcp = { path = "../fake-tcp", version = "0.5" }
tokio = { version = "1.14", features = ["full"] }
tokio-util = "0.7"
log = "0.4"
pretty_env_logger = "0.5"
tokio-tun = "0.11"
num_cpus = "1.13"
neli = "0.6"
nix = { version = "0.27", features = ["net"] }
clap = { version = "4.2.5", features = ["cargo"] }
socket2 = { version = "0.5.2", features = ["all"] }
fake-tcp = { path = "../fake-tcp", version = "0.5.5" }
tokio = { version = "1.28.0", features = ["full"] }
tokio-util = "0.7.8"
log = "0.4.17"
env_logger = "0.10.0"
chrono = "0.4.24"
tokio-tun = "0.11.2"
num_cpus = "1.15.0"
neli = "0.6.4"
nix = { version = "0.27.1", features = ["net"] }
27 changes: 26 additions & 1 deletion phantun/src/bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ use clap::{crate_version, Arg, ArgAction, Command};
use fake_tcp::packet::MAX_PACKET_LEN;
use fake_tcp::{Socket, Stack};
use log::{debug, error, info};
use chrono::Local;
use log::LevelFilter;
use std::io::Write;
use env_logger::fmt::Color;
use Color::{Blue, Cyan, Green, Red, Yellow};
use log::Level;
use phantun::utils::{assign_ipv6_address, new_udp_reuseport};
use std::collections::HashMap;
use std::fs;
Expand All @@ -17,7 +23,26 @@ use phantun::UDP_TTL;

#[tokio::main]
async fn main() -> io::Result<()> {
pretty_env_logger::init();
env_logger::Builder::new()
.format(|buf, record| {
let mut level_style = buf.style();
match record.level() {
Level::Trace => level_style.set_color(Cyan),
Level::Debug => level_style.set_color(Blue),
Level::Info => level_style.set_color(Green),
Level::Warn => level_style.set_color(Yellow),
Level::Error => level_style.set_color(Red).set_bold(true),
};
writeln!(buf,
"[{} {} {}] {}",
Local::now().format("%d-%m-%Y %H:%M:%S"),
level_style.value(record.level()),
record.target(),
record.args()
)
})
.filter(None, LevelFilter::Info)
.init();

let matches = Command::new("Phantun Client")
.version(crate_version!())
Expand Down
27 changes: 26 additions & 1 deletion phantun/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ use clap::{crate_version, Arg, ArgAction, Command};
use fake_tcp::packet::MAX_PACKET_LEN;
use fake_tcp::Stack;
use log::{debug, error, info};
use chrono::Local;
use log::LevelFilter;
use std::io::Write;
use env_logger::fmt::Color;
use Color::{Blue, Cyan, Green, Red, Yellow};
use log::Level;
use phantun::utils::{assign_ipv6_address, new_udp_reuseport};
use std::fs;
use std::io;
Expand All @@ -17,7 +23,26 @@ use phantun::UDP_TTL;

#[tokio::main]
async fn main() -> io::Result<()> {
pretty_env_logger::init();
env_logger::Builder::new()
.format(|buf, record| {
let mut level_style = buf.style();
match record.level() {
Level::Trace => level_style.set_color(Cyan),
Level::Debug => level_style.set_color(Blue),
Level::Info => level_style.set_color(Green),
Level::Warn => level_style.set_color(Yellow),
Level::Error => level_style.set_color(Red).set_bold(true),
};
writeln!(buf,
"[{} {} {}] {}",
Local::now().format("%d-%m-%Y %H:%M:%S"),
level_style.value(record.level()),
record.target(),
record.args()
)
})
.filter(None, LevelFilter::Info)
.init();

let matches = Command::new("Phantun Server")
.version(crate_version!())
Expand Down