Skip to content

Commit

Permalink
tun seemingly working
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Sep 11, 2023
1 parent 3b2cda1 commit 406455a
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 103 deletions.
3 changes: 2 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ target-dir = "target"
rustflags = ["--cfg", "tokio_unstable"]

[env]
BORING_BSSL_SOURCE_PATH = { value = "deps/boringssl/src", relative = true}
BORING_BSSL_SOURCE_PATH = { value = "deps/boringssl/src", relative = true}
RUST_LOG= { value = "clash=trace" }
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions clash/tests/data/config/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ dns:
# involved. Clash answers the DNS question with the first result gathered.
nameserver:
- 114.114.114.114 # default value
- 8.8.8.8 # default value
- tls://dns.google:853 # DNS over TLS
- https://dns.google/dns-query # DNS over HTTPS
- 1.1.1.1 # default value
- tls://1.1.1.1:853 # DNS over TLS
- https://1.1.1.1/dns-query # DNS over HTTPS
# - dhcp://en0 # dns from dhcp

allow-lan: true
Expand Down Expand Up @@ -146,16 +146,23 @@ proxies:
path: /api/v3/download.getFile
headers:
Host: 5607b9d187e655736f563fee87d7283994721.laowanxiang.com
- name: "ss-simple"
type: ss
server: 10.0.0.13
port: 8388
cipher: aes-256-gcm
password: "password"
udp: true

proxy-providers:
file-provider:
type: file
path: ./ss.yaml
interval: 5
interval: 300
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 5
interval: 300

rules:
- DOMAIN,ipinfo.io,relay
Expand All @@ -166,7 +173,7 @@ rules:
- DOMAIN,google.com,select
- SRC-IP-CIDR,192.168.1.1/24,DIRECT
- GEOIP,CN,DIRECT
- DST-PORT,53,plain-vmess
- DST-PORT,53,ss-simple
- SRC-PORT,7777,DIRECT
- MATCH, DIRECT
...
10 changes: 5 additions & 5 deletions clash_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ axum = { version = "0.6.20", features = ["ws"] }
tower-http = { version = "0.4.0", features = ["fs", "trace", "cors"] }
chrono = { version = "0.4.26", features = ["serde"] }
tun = { git = "https://github.com/Watfaq/rust-tun.git", rev = "5c0702b", features = ["async"] }
netstack-lwip = { git = "https://github.com/Watfaq/netstack-lwip.git", rev = "4fef23" }
netstack-lwip = { git = "https://github.com/Watfaq/netstack-lwip.git", rev = "8c8c0b0" }


serde = { version = "1.0", features=["derive"] }
serde_yaml = "0.9"
erased-serde = "0.3.30"

trust-dns-client = { git = "https://github.com/Watfaq/trust-dns.git", rev = "ca798f2" }
trust-dns-resolver = { git = "https://github.com/Watfaq/trust-dns.git", rev = "ca798f2" }
trust-dns-server = { git = "https://github.com/Watfaq/trust-dns.git", rev = "ca798f2", features = ["dns-over-rustls", "dns-over-https-rustls"] }
trust-dns-proto = { git = "https://github.com/Watfaq/trust-dns.git", rev = "ca798f2", features = ["dns-over-rustls", "dns-over-https-rustls"] }
trust-dns-client = { git = "https://github.com/Watfaq/trust-dns.git", rev = "3386076" }
trust-dns-resolver = { git = "https://github.com/Watfaq/trust-dns.git", rev = "3386076" }
trust-dns-server = { git = "https://github.com/Watfaq/trust-dns.git", rev = "3386076", features = ["dns-over-rustls", "dns-over-https-rustls"] }
trust-dns-proto = { git = "https://github.com/Watfaq/trust-dns.git", rev = "3386076", features = ["dns-over-rustls", "dns-over-https-rustls"] }

# trust-dns-resolver = "0.23"
# trust-dns-server = { version = "0.23", features = ["dns-over-rustls", "dns-over-https-rustls"] }
Expand Down
5 changes: 3 additions & 2 deletions clash_lib/src/app/api/handlers/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use axum::{
use http::{HeaderMap, Request};
use hyper::{body::HttpBody, Body};
use serde::Deserialize;
use tracing::warn;
use tracing::{debug, warn};

use crate::app::{
api::{handlers::utils::is_request_websocket, AppState},
Expand Down Expand Up @@ -72,7 +72,8 @@ async fn get_connections(
let body = String::from_utf8(j.to_vec()).unwrap();

if let Err(e) = socket.send(Message::Text(body)).await {
warn!("ws send error: {}", e);
// likely client gone
debug!("ws send error: {}", e);
break;
}

Expand Down
Loading

0 comments on commit 406455a

Please sign in to comment.