Skip to content

Commit d96b8d5

Browse files
committed
Add NoizDNS transport to TUI, auto-download, and Change MTU docs
- TUI "Add tunnel" (option 2) now offers NoizDNS as transport option 3 - ensure_noizdns_binary() extracted as reusable download function - --add-domain auto-downloads NoizDNS binary if missing - Correct slipnet URL type (sayedns) for NoizDNS regardless of tag name - NoizDNS startup verification: retry with restart before removing - README updated with new TUI options and NoizDNS transport info
1 parent e621ff4 commit d96b8d5

2 files changed

Lines changed: 78 additions & 37 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ New optional feature to connect an existing **3x-ui panel** (or raw Xray) to a D
5959
### Other Improvements
6060

6161
- **7 DNS records** (was 5) — 2 new NS records for NoizDNS subdomains (`n`, `z`)
62-
- **`--add-domain`** now creates NoizDNS tunnels for backup domains too
62+
- **`--add-domain`** now creates NoizDNS tunnels for backup domains too (auto-downloads NoizDNS binary if missing)
63+
- **`--add-tunnel`** (TUI option 2) now offers NoizDNS as a transport choice alongside Slipstream and DNSTT
64+
- **`--manage`** (TUI option 9) adds Change DNSTT MTU — update MTU on existing DNSTT tunnels without recreating them
6365
- **`--status`** displays NoizDNS tunnel info and SlipNet URLs
6466
- **`--remove-tunnel`** properly cleans up Xray and NoizDNS service overrides
6567
- **Security hardening** — SQL injection prevention, cookie jar cleanup, restrictive file permissions, URL-safe base64 encoding
@@ -400,7 +402,7 @@ sudo bash dnstm-setup.sh --mtu 1200
400402
# 🌐 Add a backup domain with custom MTU
401403
sudo bash dnstm-setup.sh --add-domain --mtu 1200
402404

403-
# 🚇 Add a single tunnel (interactive)
405+
# 🚇 Add a single tunnel (interactive — Slipstream, DNSTT, or NoizDNS)
404406
sudo bash dnstm-setup.sh --add-tunnel
405407

406408
# 🔌 Connect existing Xray panel (3x-ui) via DNS tunnel
@@ -536,7 +538,7 @@ sudo bash dnstm-setup.sh --manage
536538
# 📊 Show everything: tunnels, credentials, share URLs (all in one)
537539
sudo bash dnstm-setup.sh --status
538540

539-
# 🚇 Add a single tunnel (interactive — pick transport, backend, domain, tag)
541+
# 🚇 Add a single tunnel (interactive — pick Slipstream/DNSTT/NoizDNS, backend, domain, tag)
540542
sudo bash dnstm-setup.sh --add-tunnel
541543

542544
# 🔌 Add Xray backend (connect existing 3x-ui panel via DNS tunnel)

dnstm-setup.sh

Lines changed: 73 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,19 +1630,30 @@ do_add_tunnel() {
16301630
echo -e " ${BOLD}Transport:${NC}"
16311631
echo -e " ${BOLD}1)${NC} Slipstream ${DIM}(QUIC + TLS, faster ~63 KB/s)${NC}"
16321632
echo -e " ${BOLD}2)${NC} DNSTT ${DIM}(Noise + Curve25519, ~42 KB/s)${NC}"
1633+
echo -e " ${BOLD}3)${NC} NoizDNS ${DIM}(DPI-resistant DNSTT fork)${NC}"
16331634
echo ""
16341635
local transport_choice
1635-
transport_choice=$(prompt_input "Select transport (1-2)" "1")
1636+
transport_choice=$(prompt_input "Select transport (1-3)" "1")
16361637
local transport
1638+
local use_noizdns=false
16371639
case "$transport_choice" in
16381640
1) transport="slipstream" ;;
16391641
2) transport="dnstt" ;;
1642+
3)
1643+
transport="dnstt"
1644+
use_noizdns=true
1645+
# Ensure noizdns binary is available
1646+
if ! ensure_noizdns_binary; then
1647+
print_fail "NoizDNS binary not available. Cannot create NoizDNS tunnel."
1648+
exit 1
1649+
fi
1650+
;;
16401651
*)
1641-
print_fail "Invalid selection. Use 1 or 2."
1652+
print_fail "Invalid selection. Use 1, 2, or 3."
16421653
exit 1
16431654
;;
16441655
esac
1645-
print_ok "Transport: ${transport}"
1656+
print_ok "Transport: ${transport}$( [[ "$use_noizdns" == true ]] && echo ' (NoizDNS)' )"
16461657
echo ""
16471658

16481659
# 2. Choose backend
@@ -1736,6 +1747,14 @@ do_add_tunnel() {
17361747
exit 1
17371748
fi
17381749

1750+
# Apply NoizDNS override if selected
1751+
if [[ "$use_noizdns" == true ]]; then
1752+
create_noizdns_service_override "$tag" || print_warn "Could not set NoizDNS binary for ${tag}"
1753+
# Stop tunnel so it restarts with noizdns-server binary
1754+
systemctl stop "dnstm-${tag}.service" 2>/dev/null || true
1755+
systemctl daemon-reload 2>/dev/null || true
1756+
fi
1757+
17391758
# Show DNSTT pubkey if applicable
17401759
if [[ "$transport" == "dnstt" && -f "/etc/dnstm/tunnels/${tag}/server.pub" ]]; then
17411760
local pubkey
@@ -1803,7 +1822,7 @@ do_add_tunnel() {
18031822
dnstt) slipnet_type="dnstt" ;;
18041823
esac
18051824
# NoizDNS tunnels use dnstt transport but need sayedns type for SlipNet
1806-
[[ "$tag" == noiz* ]] && slipnet_type="sayedns"
1825+
[[ "$use_noizdns" == true || "$tag" == noiz* ]] && slipnet_type="sayedns"
18071826

18081827
DOMAIN="$base_domain"
18091828
local slipnet_url
@@ -2925,6 +2944,53 @@ save_xray_config() {
29252944
print_ok "Saved config: ${config_file}"
29262945
}
29272946

2947+
# ─── NoizDNS Binary Download ──────────────────────────────────────────────────
2948+
2949+
# Download and verify the NoizDNS server binary if not already installed.
2950+
# Returns 0 if binary is available (already existed or freshly downloaded), 1 otherwise.
2951+
ensure_noizdns_binary() {
2952+
# Already installed and working
2953+
if [[ -x /usr/local/bin/noizdns-server ]]; then
2954+
return 0
2955+
fi
2956+
2957+
print_info "Downloading NoizDNS server (DPI-resistant tunnel)..."
2958+
local arch
2959+
arch=$(detect_architecture)
2960+
local noizdns_arch="$arch"
2961+
[[ "$noizdns_arch" == "armv7" ]] && noizdns_arch="arm"
2962+
2963+
local noizdns_downloaded=false
2964+
local noizdns_release_url="https://github.com/anonvector/noizdns-deploy/releases/latest/download/dnstt-server-linux-${noizdns_arch}"
2965+
local noizdns_raw_url="https://raw.githubusercontent.com/anonvector/noizdns-deploy/main/bin/dnstt-server-linux-${noizdns_arch}"
2966+
2967+
if curl -fsSL -o /usr/local/bin/noizdns-server "$noizdns_release_url" 2>/dev/null; then
2968+
noizdns_downloaded=true
2969+
elif curl -fsSL -o /usr/local/bin/noizdns-server "$noizdns_raw_url" 2>/dev/null; then
2970+
noizdns_downloaded=true
2971+
fi
2972+
2973+
if [[ "$noizdns_downloaded" == true ]]; then
2974+
chmod +x /usr/local/bin/noizdns-server
2975+
if [[ ! -s /usr/local/bin/noizdns-server ]]; then
2976+
print_warn "NoizDNS binary is empty (download may have failed)"
2977+
rm -f /usr/local/bin/noizdns-server
2978+
return 1
2979+
elif timeout 3 /usr/local/bin/noizdns-server -help 2>&1 | grep -qi "usage\|flag\|dnstt\|privkey"; then
2980+
print_ok "NoizDNS server installed and verified"
2981+
return 0
2982+
else
2983+
print_warn "NoizDNS binary downloaded but may be corrupt or wrong architecture"
2984+
rm -f /usr/local/bin/noizdns-server
2985+
return 1
2986+
fi
2987+
else
2988+
print_warn "Could not download NoizDNS server (GitHub may be blocked)"
2989+
print_info "Manual install: curl -fsSL -o /usr/local/bin/noizdns-server ${noizdns_release_url} && chmod +x /usr/local/bin/noizdns-server"
2990+
return 1
2991+
fi
2992+
}
2993+
29282994
# ─── NoizDNS Service Override ─────────────────────────────────────────────────
29292995

29302996
# Override a DNSTT tunnel's systemd service to use the NoizDNS binary instead.
@@ -3785,35 +3851,7 @@ step_install_dnstm() {
37853851

37863852
# Download NoizDNS server binary (DPI-resistant DNSTT fork)
37873853
echo ""
3788-
print_info "Downloading NoizDNS server (DPI-resistant tunnel)..."
3789-
# NoizDNS uses "arm" not "armv7" for ARM builds
3790-
local noizdns_arch="$arch"
3791-
[[ "$noizdns_arch" == "armv7" ]] && noizdns_arch="arm"
3792-
# Try GitHub Releases first (less likely blocked), then raw content as fallback
3793-
local noizdns_downloaded=false
3794-
local noizdns_release_url="https://github.com/anonvector/noizdns-deploy/releases/latest/download/dnstt-server-linux-${noizdns_arch}"
3795-
local noizdns_raw_url="https://raw.githubusercontent.com/anonvector/noizdns-deploy/main/bin/dnstt-server-linux-${noizdns_arch}"
3796-
if curl -fsSL -o /usr/local/bin/noizdns-server "$noizdns_release_url" 2>/dev/null; then
3797-
noizdns_downloaded=true
3798-
elif curl -fsSL -o /usr/local/bin/noizdns-server "$noizdns_raw_url" 2>/dev/null; then
3799-
noizdns_downloaded=true
3800-
fi
3801-
if [[ "$noizdns_downloaded" == true ]]; then
3802-
chmod +x /usr/local/bin/noizdns-server
3803-
# Verify binary is real (not HTML error page, 0-byte, or wrong architecture)
3804-
if [[ ! -s /usr/local/bin/noizdns-server ]]; then
3805-
print_warn "NoizDNS binary is empty (download may have failed)"
3806-
rm -f /usr/local/bin/noizdns-server
3807-
elif timeout 3 /usr/local/bin/noizdns-server -help 2>&1 | grep -qi "usage\|flag\|dnstt\|privkey"; then
3808-
print_ok "NoizDNS server installed and verified"
3809-
else
3810-
print_warn "NoizDNS binary downloaded but may be corrupt or wrong architecture"
3811-
rm -f /usr/local/bin/noizdns-server
3812-
fi
3813-
else
3814-
print_warn "Could not download NoizDNS server from any source (NoizDNS tunnels will be skipped)"
3815-
print_info "Manual install: curl -fsSL -o /usr/local/bin/noizdns-server ${noizdns_release_url}"
3816-
fi
3854+
ensure_noizdns_binary || true
38173855
}
38183856

38193857
# ─── STEP 6: Verify Port 53 ────────────────────────────────────────────────────
@@ -4997,7 +5035,8 @@ do_add_domain() {
49975035
DNSTT_PUBKEY=$(cat "/etc/dnstm/tunnels/${dnstt_tag}/server.pub" 2>/dev/null || true)
49985036
fi
49995037

5000-
# NoizDNS tunnels (if binary available)
5038+
# NoizDNS tunnels — download binary if not available, then create tunnels
5039+
ensure_noizdns_binary || true
50015040
if [[ -x /usr/local/bin/noizdns-server ]]; then
50025041
local noiz_tag="noiz${num}"
50035042
local noiz_ssh_tag="noiz-ssh${num}"

0 commit comments

Comments
 (0)