491 Commits
Author SHA1 Message Date
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
eric 3918d1c04c v0.12.0 v0.12.0 2025-11-05 15:09:13 +08:00
eric d7642868da Added hc inbound for management purposes 2025-10-28 20:12:05 +08:00
eric 1a66eb47a8 Added health check functions for client 2025-10-28 19:39:14 +08:00
eric e9646b94ab Free nf on shutdown 2025-10-14 14:24:06 +08:00
eric 033213d8a5 Support PROCESS-NAME rule 2025-10-12 13:44:36 +08:00
eric e588194cc1 Fix iOS simulator build 2025-10-01 18:09:10 +08:00
eric 93000df6aa Support NetFilter inbound 2025-10-01 17:27:23 +08:00
eric 36e3bd41c8 Fixed a domain sniffing issue 2025-10-01 11:54:12 +08:00
eric cecb7772a6 Remove private config 2025-08-18 21:00:30 +08:00
eric b8ae6c8fb1 Update deps 2025-08-12 20:06:48 +08:00
eric 49aa8f8677 Added NONE loglevel to skip logger setup 2025-05-02 13:40:49 +08:00
eric 45be5f1853 Updated deps 2025-03-28 13:49:58 +08:00
lanthora beb0a3efce change netstack-lwip upstream 2025-02-22 14:11:59 +08:00
lanthora 9ec9046abd support windows 2025-02-17 21:18:13 +08:00
eric de8f5272f7 Fix outbound binding at loopback 2025-01-19 13:49:15 +08:00
Chinsyo 8bc305c342 Update github actions checkout to v4, update rust-toolchain for *-apple-darwin to stable 2024-10-19 09:02:06 +08:00
Chinsyo 5b70ec9365 Perform cargo fmt 2024-10-18 17:05:10 +08:00
Chinsyo b2a58d9e13 Fix clippy lints 2024-10-18 17:05:10 +08:00
eric 2dab68c940 Fix clippy lints 2024-10-08 21:12:02 +08:00
Chinsyo d15af318ab Simplify empty check, relace length validation to is_empty() 2024-10-08 20:16:12 +08:00
Chinsyo 74614c087e Remove unneeded guard statement 2024-10-08 20:16:12 +08:00
Chinsyo 10f402706a Simplify unneeded return statement 2024-10-08 20:16:12 +08:00
Chinsyo dbee706608 Fixing cargo clippy clone_on_copy issues 2024-10-08 20:16:12 +08:00
Chinsyo ea66bd9938 Moving local variable declaration closer to usage 2024-10-08 20:16:12 +08:00
Chinsyo 73ae6adb46 Rename unused variable, add underscore prefix 2024-10-08 20:16:12 +08:00
Chinsyo e37097b36c Remove unnecessary pub(self) 2024-10-08 20:16:12 +08:00
Chinsyo 443828f48e Remove casting type to original type 2024-10-08 20:16:12 +08:00
Chinsyo 1e60649448 Refactor `assert_eq!(_EXPRESSION_, true) to assert!(_EXPRESSION_) 2024-10-08 20:16:12 +08:00
Chinsyo 9b7c55d91b Simplify group imports for single item 2024-10-08 20:16:12 +08:00
eric a6070a7ef8 Support multiple health check requests for the failover outbound 2024-10-07 19:14:51 +08:00
eric 061bc75a44 Refactor 2024-10-07 17:47:14 +08:00
eric 09d1a97dc2 Added healthCheckWait option for failover outbound 2024-10-07 16:53:30 +08:00