@@ -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