feat(ng2): add no_proxy to terminal proxy commands

This commit is contained in:
Qiu Yuzhou
2026-09-29 17:42:16 +08:00
parent 59f50380cf
commit 1b57807cba
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
- **Legacy Privoxy adapter**: The frozen implementation's HTTP(S)-to-local-SOCKS5 bridge. It is a Legacy-only dependency and is not migrated into 2.0.
- **Listener mode**: The user-facing choice that determines which address families the local proxy listeners accept: this Mac only (IPv4 loopback), all IPv4 interfaces, all IPv4 and IPv6 interfaces, or all IPv6 interfaces only. One mode applies to both the local SOCKS and HTTP proxy inbounds. _Avoid_: Listen scope.
- **HTTP proxy environment command**: An HTTP-only terminal command that sets lowercase `http_proxy` and `https_proxy` for this Mac's local HTTP proxy inbound. It always targets a loopback address for the selected listener mode.
- **Terminal proxy environment commands**: Shell-specific commands for zsh/bash and fish that set lowercase `http_proxy` and `https_proxy` through the local HTTP inbound and `all_proxy` through the local SOCKS inbound. They target loopback addresses selected by listener mode and affect child processes that honor these variables.
- **Terminal proxy environment commands**: Shell-specific commands for zsh/bash and fish that set lowercase `http_proxy` and `https_proxy` through the local HTTP inbound, `all_proxy` through the local SOCKS inbound, and `no_proxy` for `localhost`, `127.0.0.1`, `::1`, and `.local` hostnames. The proxy endpoints use loopback addresses selected by listener mode, and the commands affect child processes that honor these variables.
- **Proxy runtime**: The per-user background host process, independent of the GUI's lifetime, that runs the external tunnel service and loads the optional generated ACL sidecar.
- **Legacy configuration**: The server list and preferences persisted by the frozen implementation in `Legacy/`.
- **Legacy import**: The user-confirmed, read-only translation of a Legacy configuration's server records into a separate manual group in 2.0. It migrates no preferences, activates no target, and neither starts proxying nor alters the Legacy source.
@@ -90,17 +90,20 @@ extension TerminalProxyEnvironmentCommands {
let host = listen.proxyLoopbackURLHost
let httpEndpoint = "'http://\(host):\(listen.httpPort)'"
let socksEndpoint = "'socks5://\(host):\(listen.socksPort)'"
let noProxy = "'localhost,127.0.0.1,::1,.local'"
let zshBash =
[
"export http_proxy=\(httpEndpoint)",
"export https_proxy=\(httpEndpoint)",
"export all_proxy=\(socksEndpoint)",
"export no_proxy=\(noProxy)",
].joined(separator: "; ") + ";"
let fish =
[
"set -gx http_proxy \(httpEndpoint)",
"set -gx https_proxy \(httpEndpoint)",
"set -gx all_proxy \(socksEndpoint)",
"set -gx no_proxy \(noProxy)",
].joined(separator: "; ") + ";"
self.init(
zshBash: zshBash,