fix: default to udp://1.1.1.1 DNS (DoT fails silently, breaks all proxy connections)

This commit is contained in:
2026-07-19 01:22:08 +03:00
parent 5addc6471e
commit 467ab7edf1
5 changed files with 8 additions and 6 deletions
+2
View File
@@ -0,0 +1,2 @@
__pycache__
.git
+1 -1
View File
@@ -6,5 +6,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
COPY --from=sb-bin /usr/local/bin/sing-box /usr/local/bin/sing-box
RUN chmod +x /usr/local/bin/sing-box
WORKDIR /src
COPY entrypoint.py .
COPY . .
ENTRYPOINT ["python3", "entrypoint.py"]
+1 -1
View File
@@ -21,7 +21,7 @@ Connect to `socks5://localhost:1080`.
| `SOCKS_PORT` | no | `1080` | SOCKS5 listen port |
| `SOCKS_USER` | no | `""` | Auth username (leave empty to skip auth) |
| `SOCKS_PASS` | no | `""` | Auth password |
| `DNS_SERVER` | no | `tls://8.8.8.8` | Upstream DNS resolver address |
| `DNS_SERVER` | no | `udp://1.1.1.1` | Upstream DNS resolver address (insecure UDP by default) |
| `PICK_STRATEGY` | no | `first` | Node selection: `first` (default) or `random` |
| `LOG_LEVEL` | no | `info` | sing-box log level (`debug`, `warn`, `error`) |
+2 -2
View File
@@ -23,7 +23,7 @@ def make_dns_server(addr_str: str) -> Dict[str, Any]:
Supports: udp://host:port, tls://host(:port), https://host(:port), bare IP/hostname.
Args:
addr_str: DNS server address string (e.g. "tls://8.8.8.8", "udp://1.1.1.1:53").
addr_str: DNS server address string (e.g. "udp://1.1.1.1", "tls://8.8.8.8").
Returns:
Dictionary compatible with sing-box DNS server schema.
@@ -56,7 +56,7 @@ def build_singbox_config(
socks_port: int = 1080,
socks_user: str = "",
socks_pass: str = "",
dns_server: str = "tls://8.8.8.8",
dns_server: str = "udp://1.1.1.1",
log_level: str = "info",
) -> Dict[str, Any]:
"""Build a complete sing-box JSON configuration.
+2 -2
View File
@@ -56,7 +56,7 @@ def run(
socks_port: int = 1080,
socks_user: str = "",
socks_pass: str = "",
dns_server: str = "tls://8.8.8.8",
dns_server: str = "udp://1.1.1.1",
pick_strategy: str = "first",
log_level: str = "info",
config_file_path: str = "/tmp/.sub2socks.json",
@@ -159,7 +159,7 @@ def main() -> None:
socks_port=int(os.environ.get("SOCKS_PORT", "1080")),
socks_user=os.environ.get("SOCKS_USER", ""),
socks_pass=os.environ.get("SOCKS_PASS", ""),
dns_server=os.environ.get("DNS_SERVER", "tls://8.8.8.8"),
dns_server=os.environ.get("DNS_SERVER", "udp://1.1.1.1"),
pick_strategy=os.environ.get("PICK_STRATEGY", "first"),
log_level=os.environ.get("LOG_LEVEL", "info"),
)