[PR #6611] [MERGED] fix(amneziawg): stop AAAA fallback on v4-only tunnels and expose I2–I5 #6377

Closed
opened 2026-11-02 04:08:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6611
Author: @mrchatam
Created: 9/19/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: fix/awg-outbound-ipv6-dns-i2-i5


📝 Commits (3)

  • 9f9edb3 fix(amneziawg): stop AAAA fallback on v4-only tunnels and expose I2–I5
  • 2c93762 ci: retrigger frontend after npm registry maintenance
  • 9ea6b95 style(amneziawg): keep the tunnel DNS family comments to two lines

📊 Changes

4 files changed (+147 additions, -8 deletions)

View changed files

📝 frontend/src/pages/xray/outbounds/protocols/amneziawg.tsx (+4 -0)
📝 internal/amneziawgnet/dns.go (+29 -8)
➕ internal/amneziawgnet/dns_family_test.go (+107 -0)
📝 internal/amneziawgnet/egress.go (+7 -0)

📄 Description

Summary

Fixes intermittent AmneziaWG outbound probe/connect failures on IPv4-only tunnels, and surfaces the missing I2–I5 obfuscation fields in the outbound form.

DNS / AAAA (primary): exchangeTunnelDNSWithFallback used to query A then fall back to AAAA whenever A failed, even when the device had no IPv6 local address. The netstack only installs an IPv6 default route when the outbound address list includes IPv6, so the AAAA answer was unroutable (network is unreachable). The family-agnostic 60s DNS cache then kept poisoning probes. This change queries only families the tunnel can dial (dnsQueryTypesFor), and rejects undialable literal IPs early in SOCKS CONNECT / UDP dial paths.

UI: Outbound AmneziaWG form already had I1–I5 in the Zod schema and wire adapter but only rendered i1. Render I2–I5 to match the inbound form and schema.

Fixes #6570

Changes

  • internal/amneziawgnet/dns.go — dnsQueryTypesFor / tunnelSupportsAddr; gate exchangeTunnelDNSWithFallback
  • internal/amneziawgnet/egress.go — reject wrong-family literal IPs in resolveTunnelVia and UDP getOrDial
  • internal/amneziawgnet/dns_family_test.go — unit tests for query types, family checks, and literal rejection
  • frontend/.../outbounds/protocols/amneziawg.tsx — expose I2–I5 fields

Test plan

  • go test ./internal/amneziawgnet/ -count=1
  • npm run format:check in frontend/ (oxfmt)
  • Create an IPv4-only AmneziaWG outbound; HTTP / Real Delay probe against a dual-stack host should stop failing with dial tunnel [2001:…]:443: network is unreachable
  • Confirm I2–I5 appear on the outbound form and round-trip through save/reload
  • Dual-stack and IPv6-only address lists still resolve A/AAAA as appropriate

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6611 **Author:** [@mrchatam](https://github.com/mrchatam) **Created:** 9/19/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/awg-outbound-ipv6-dns-i2-i5` --- ### 📝 Commits (3) - [`9f9edb3`](https://github.com/MHSanaei/3x-ui/commit/9f9edb3c5ae01c5e6ff99bcb2889b8143f419980) fix(amneziawg): stop AAAA fallback on v4-only tunnels and expose I2–I5 - [`2c93762`](https://github.com/MHSanaei/3x-ui/commit/2c937625e8a3ef8f8b49157fb0cd9b86dd9ea81d) ci: retrigger frontend after npm registry maintenance - [`9ea6b95`](https://github.com/MHSanaei/3x-ui/commit/9ea6b95c5b0c6448afff9143e6aeb51e168775dd) style(amneziawg): keep the tunnel DNS family comments to two lines ### 📊 Changes **4 files changed** (+147 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/xray/outbounds/protocols/amneziawg.tsx` (+4 -0) 📝 `internal/amneziawgnet/dns.go` (+29 -8) ➕ `internal/amneziawgnet/dns_family_test.go` (+107 -0) 📝 `internal/amneziawgnet/egress.go` (+7 -0) </details> ### 📄 Description ## Summary Fixes intermittent AmneziaWG outbound probe/connect failures on IPv4-only tunnels, and surfaces the missing I2–I5 obfuscation fields in the outbound form. **DNS / AAAA (primary):** `exchangeTunnelDNSWithFallback` used to query A then fall back to AAAA whenever A failed, even when the device had no IPv6 local address. The netstack only installs an IPv6 default route when the outbound `address` list includes IPv6, so the AAAA answer was unroutable (`network is unreachable`). The family-agnostic 60s DNS cache then kept poisoning probes. This change queries only families the tunnel can dial (`dnsQueryTypesFor`), and rejects undialable literal IPs early in SOCKS CONNECT / UDP dial paths. **UI:** Outbound AmneziaWG form already had I1–I5 in the Zod schema and wire adapter but only rendered `i1`. Render I2–I5 to match the inbound form and schema. Fixes #6570 ## Changes - `internal/amneziawgnet/dns.go` — `dnsQueryTypesFor` / `tunnelSupportsAddr`; gate `exchangeTunnelDNSWithFallback` - `internal/amneziawgnet/egress.go` — reject wrong-family literal IPs in `resolveTunnelVia` and UDP `getOrDial` - `internal/amneziawgnet/dns_family_test.go` — unit tests for query types, family checks, and literal rejection - `frontend/.../outbounds/protocols/amneziawg.tsx` — expose I2–I5 fields ## Test plan - [x] `go test ./internal/amneziawgnet/ -count=1` - [x] `npm run format:check` in `frontend/` (oxfmt) - [ ] Create an IPv4-only AmneziaWG outbound; HTTP / Real Delay probe against a dual-stack host should stop failing with `dial tunnel [2001:…]:443: network is unreachable` - [ ] Confirm I2–I5 appear on the outbound form and round-trip through save/reload - [ ] Dual-stack and IPv6-only address lists still resolve A/AAAA as appropriate --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6377
No description provided.