523 Commits
Author SHA1 Message Date
eric 1303e3ebf0 Add wintun support 2026-02-22 16:19:33 +08:00
eric 7ad1345234 Update readme 2026-02-22 15:44:51 +08:00
eric 8f43c2b98e Refine Socks and tests 2026-02-22 13:38:39 +08:00
eric fef4e0cae1 Fix connection stats 2026-02-22 09:58:01 +08:00
eric d2004454c1 Refactor 2026-02-22 08:56:50 +08:00
eric 28634cfdbf Fixed resloving DNS sniffed domain 2026-02-22 08:08:20 +08:00
eric 6ea6c6147a Fix Android build 2026-02-22 00:47:19 +08:00
eric b1b64d54ef Add VLess + Reality (experimental) 2026-02-22 00:28:22 +08:00
eric 84a7d02e31 Fix domain override 2026-02-21 23:53:33 +08:00
eric 043194c715 Fix UDP dispatch 2026-02-21 23:43:46 +08:00
eric 8eb47013e5 Always sniff TLS and HTTP 2026-02-21 23:35:17 +08:00
eric d4a3f91f15 Refine build scripts 2026-02-21 15:14:18 +08:00
eric b6394345cb Fix tun2socks backend option in conf 2026-02-21 14:19:49 +08:00
eric fde29e7641 Fix build warnings 2026-02-21 13:58:30 +08:00
eric 87fd7ed149 Add tun2socks-backend conf option 2026-02-21 13:37:20 +08:00
eric 80a8ca918e Update dep netstack-smoltcp 2026-02-21 13:07:20 +08:00
eric 98baeb04e8 Skip FakeDNS handling by default 2026-02-21 12:55:07 +08:00
eric 1d0e982bb2 Add netstack-smoltcp tun2socks backend 2026-02-21 12:47:36 +08:00
eric a68c775af2 Deprioritize DNS sniffed domains 2026-02-19 15:15:30 +08:00
eric 34b6a3be70 Refactor domain overrdide logic 2026-02-19 15:00:19 +08:00
eric c9ad91328f Sniff domain name from DNS 2026-02-19 14:11:14 +08:00
JockLee 742fa073cd fix: resolve compilation warnings on Rust 1.93+
- Replace deprecated `TcpStream::set_linger()` with `SockRef::from().set_linger()`
  (tokio deprecated the method as SO_LINGER can block the thread on drop)
- Prefix unused parameter `gw` with underscore in `add_interface_ipv4_address()`
  (the gateway param is unused on Linux as `ip addr add` does not accept it)
2026-02-19 12:40:54 +08:00
eric 5c33e7fd82 Add connection start_time 2026-02-19 11:44:48 +08:00
eric 6c08b7c0bc Fix connection stats 2026-02-19 11:25:48 +08:00
eric 1abd136284 Support VMessAEAD (enabled by default) 2026-02-14 16:18:12 +08:00
eric a86f91a969 Support compact log format 2026-02-14 15:24:50 +08:00
eric 8897827d33 Use vendored protoc 2026-02-14 15:07:56 +08:00
eric f401352b76 Filter leaf logs 2026-02-14 14:47:58 +08:00
eric 65af4b08cb Improve dual-stack DNS queries 2026-02-14 14:47:47 +08:00
shenshengkafei 9a061b4018 Fix the bug that lib crashed when a SOCKS proxy was configured with a domain name instead of an IP address 2026-02-11 07:51:37 +08:00
eric c37e819b95 Add dial timeout for QUIC streams 2026-02-06 07:12:14 +08:00
eric ca7e81ceb3 v0.13.0 v0.13.0 2026-02-05 18:52:11 +08:00
eric 02e2cad1a7 Fix build 2026-02-05 17:20:30 +08:00
eric 016a7fa9bc Enable QUIC by default 2026-02-05 16:11:04 +08:00
eric ef70415187 Support certificate setting in conf 2026-02-05 15:21:44 +08:00
rikaaa0928 303bd3c0af fix(config): ensure tun settings are applied when fd is -1
Previously, when parsing INI configurations, `tun_fd` would default to `Some(-1)`. In [leaf/src/config/common.rs](cci:7://file:///Users/rikaaa0928/src/github/rust/leaf/leaf/src/config/common.rs:0:0-0:0), the logic checked `if let Some(fd) = ...`, which matched even for `-1`, causing the code to skip the `else` block.

This `else` block is critical as it contains the logic for applying `auto`, `name`, `address`, and other TUN settings. This commit changes the check to `if fd >= 0`, ensuring that if an invalid FD (like -1) is present, the code falls through to correctly configure the TUN interface using the provided parameters.
2026-01-17 14:17:34 +08:00
eric de0835b33c Ignore TRAE files 2026-01-06 10:28:26 +08:00
eric 876243c25a Use identifiable trace ID 2026-01-02 07:24:25 +08:00
eric e748167d79 Enhance logging 2026-01-01 21:24:55 +08:00
eric bcc2fc803b Refactor 2026-01-01 21:00:41 +08:00
eric dbb3eb1fce Refactor 2026-01-01 20:04:33 +08:00
eric 1842876ab7 Refine error handling 2026-01-01 17:56:55 +08:00
eric 7de418adf2 Refine tests 2026-01-01 17:47:23 +08:00
eric 53944ad1f8 Replace trust-dns-proto with hickory-proto 2026-01-01 17:39:32 +08:00
eric 9dafaf5278 clippy fix 2026-01-01 16:38:58 +08:00
eric e0b5410a97 cargo fmt 2026-01-01 16:18:16 +08:00
OmarTariq612 f9204266bf propagate tun/cat listener errors to the user 2026-01-01 16:11:45 +08:00
sage417 75502fc900 refactor: unify IPv4/IPv6 cache query logic with priority ordering
- Replace repetitive cache access code with unified priority-based approach
- Add config-driven cache query order (IPv6-first, IPv4-first, or IPv4-only)
- Extract common cache expiration check and IP extraction logic
- Improve code maintainability and eliminate duplication
- Maintain same functionality with cleaner architecture

No behavioral changes - only structural improvements.
2026-01-01 16:10:16 +08:00
J.K.SAGE 98644d7655 refactor: flatten nested match and improve readability in DNS lookup loop
Refactor the DNS lookup retry loop to reduce deeply nested `match` statements
and improve code clarity and maintainability.

The original implementation had multiple levels of nested `match` blocks
for handling send, receive, timeout, and DNS response parsing, which made
the logic hard to follow and error-prone.

This refactoring:
- Replaces deep nesting with early returns and `if let` bindings where appropriate.
- Keeps the existing error classification logic (e.g., which errors are retried
  like timeouts or send failures, and which are fatal like parse errors or
  invalid DNS responses).
- Improves readability by organizing the steps sequentially:
  send → receive (with timeout) → parse → validate → extract IPs → build result.
- Maintains all existing behavior including retry logic and error handling.
- Adds clarity around TTL extraction and deadline calculation.

No functional changes — only structural and readability improvements.
2026-01-01 16:10:16 +08:00
muyuanjin 409b9a4a6d proxy/http: fix duplicated EOH when rewriting absolute-form to origin-form
When forwarding HTTP/1.x absolute-form requests from the HTTP inbound, we
serialize a new request line/headers and then append the buffered remainder.
However, the remainder starts at the original End-Of-Headers (EOH, CRLFCRLF),
so we ended up emitting two consecutive CRLFCRLF boundaries. That breaks
parsing for some servers, especially with chunked bodies or JSON payloads.

Strip a leading EOH from the remainder before concatenation so only one header
terminator is present.

This change is minimal and only affects the Absolute target format path. CONNECT
and SOCKS remain pure tunnels.
2026-01-01 16:07:32 +08:00