[GH-ISSUE #6303] [Bug]: Low speed inbound AmneziaWG #4280

Closed
opened 2026-10-31 20:38:30 +07:00 by bsakaguchi · 19 comments
Owner

Originally created by @shoei1944 on GitHub (Aug 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6303

Describe the bug

Very low download speed, while VLESS (Reality/XHTTP) provides significantly higher speeds.
AmneziaWG: DL 0.12 Mbps / UP 4.37 Mbps speedtest
VLESS: DL 200 Mbps / UP 100 Mbps speedtest

How to reproduce the problem

Не нашел

Expected behavior

Didn't find it

Actual behavior

Low speed

Relevant logs

INFO - amneziawgnet: started embedded interface awg7 for inbound 7
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused
INFO - XRAY: infra/conf/serial: Reading config: &{Name:bin/config.json Format:json}
WARNING - XRAY: infra/conf: REALITY: Changing "minClientVer" will increase the likelihood of your server's IP being blocked by the GFW
WARNING - XRAY: infra/conf: REALITY: Listening on non-443 ports will increase the likelihood of your server's IP being blocked by the GFW
WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "v6": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65105: connect: connection refused
WARNING - XRAY: core: Xray 26.7.28 started
INFO - xray core supports the online-stats API; using connection-based onlines and access-log-free IP limit

Screenshots

Image Image

3x-ui version

dev+f13baa9a

Xray-core version

26.7.28

How did you install 3x-ui?

install.sh script

Operating system

Debian 13

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

No — direct access

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @shoei1944 on GitHub (Aug 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6303 ### Describe the bug Very low download speed, while VLESS (Reality/XHTTP) provides significantly higher speeds. AmneziaWG: DL 0.12 Mbps / UP 4.37 Mbps [speedtest](https://www.speedtest.net/ru/result/19593493929) VLESS: DL 200 Mbps / UP 100 Mbps [speedtest](https://www.speedtest.net/ru/result/19593503892) ### How to reproduce the problem Не нашел ### Expected behavior Didn't find it ### Actual behavior Low speed ### Relevant logs ```shell INFO - amneziawgnet: started embedded interface awg7 for inbound 7 WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "AWG4": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65107: connect: connection refused INFO - XRAY: infra/conf/serial: Reading config: &{Name:bin/config.json Format:json} WARNING - XRAY: infra/conf: REALITY: Changing "minClientVer" will increase the likelihood of your server's IP being blocked by the GFW WARNING - XRAY: infra/conf: REALITY: Listening on non-443 ports will increase the likelihood of your server's IP being blocked by the GFW WARNING - amneziawgnet: UDPRelay: SOCKS5 associate for "v6": amneziawgnet: dial SOCKS5 control connection: dial tcp 127.0.0.1:65105: connect: connection refused WARNING - XRAY: core: Xray 26.7.28 started INFO - xray core supports the online-stats API; using connection-based onlines and access-log-free IP limit ``` ### Screenshots <img width="450" height="554" alt="Image" src="https://github.com/user-attachments/assets/6ad3d3aa-f185-4b13-b21e-652a9ece9569" /> <img width="732" height="288" alt="Image" src="https://github.com/user-attachments/assets/c7c8313e-1e5c-4cc3-8631-8aee2a20c4df" /> ### 3x-ui version dev+f13baa9a ### Xray-core version 26.7.28 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? No — direct access ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:38:30 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Aug 24, 2026):

Short version: the SOCKS5 associate ... connection refused lines in your log are not the cause — they are the Xray restart window. The download collapse is most likely the tunnel MTU versus the AmneziaWG 3.1 per-packet padding the panel enables by default, but I can't confirm that without a few values from your inbound, so I'm asking for them below.

First, a note: I can't open images, so I could not read either screenshot. Please paste the values as text.

The log warnings are a red herring

amneziawgnet: dial SOCKS5 control connection comes from internal/amneziawgnet/relay.go:108, reached only from the UDP path (UDPRelay.Handle, relay.go:342). It dials the loopback SOCKS5 inbound that lives inside Xray:

// internal/amneziawgnet/socks_config.go:12,16-18
const SOCKSBasePort = 65100
func SOCKSPortForInbound(inboundID int) int {
	return SOCKSBasePort + inboundID
}

So 65107 = inbound 7, 65105 = inbound 5. While Xray is down, that listener does not exist, and Handle caches nothing on failure — it re-dials and re-logs for every UDP datagram, which is why you get 33 identical lines. In your log every one of them appears before XRAY: core: Xray 26.7.28 started, so they are all inside one restart window. Note there is no RelayTCP: SOCKS5 CONNECT warning (relay.go:78), i.e. TCP relaying into Xray was not failing.

What I suspect is actually throttling the download

A new AmneziaWG inbound is created with the MTU field empty (frontend/src/pages/inbounds/form/protocols/amneziawg.tsx:48-50 has no default; createDefaultAmneziawgInboundSettings at frontend/src/lib/xray/inbound-defaults.ts:304-322 never sets mtu). With mtu unset the embedded interface falls back to:

// internal/amneziawgnet/device.go:19,126-128
const defaultMTU = 1420
...
mtu := inst.MTU
if mtu <= 0 {
	mtu = defaultMTU
}

and the client .conf gets no MTU = line at all (internal/sub/service.go:725-726 writes it only if server.MTU > 0).

Meanwhile the generated 3.1 obfuscation set adds bytes to every data packet:

// internal/amneziawg/params.go:57,70-71,94
o.S4 = randInt(12, 27)          // transport padding, per packet
cpLo := randInt(8, 24)
o.ContentPaddingAddition = fmt.Sprintf("%d-%d", cpLo, cpLo+randInt(8, 40))  // up to 64
o.RandomTrailers = true

(randInt is inclusive on both ends — params.go:27-36. The frontend generator is identical: frontend/src/lib/xray/amneziawg-obfuscation.ts:104,115,122.)

The arithmetic I derive from those literals — flagging it as my own derivation, not a repo constant: a 1420-byte inner packet in standard WireGuard framing is 1420 + 32 (type/reserved/receiver/counter + Poly1305 tag) + 8 UDP + 20 IPv4 = 1480 bytes on the wire, i.e. 20 bytes of headroom under a 1500-byte path MTU. S4 alone is 12–27 bytes, before ContentPaddingAddition (up to 64) and RandomTrailers. That contradicts what the repo itself asserts in two places:

  • internal/amneziawg/params.go:68-69 — // Total padding stays <= 64: it rides on full-size transport packets, the same MTU headroom that caps S4 at 32.
  • docs/content/docs/en/config/amneziawg.mdx:52 — "Kept <= 64 by the generator so a 1420-MTU tunnel doesn't fragment."

If that headroom really is 20 bytes and not ≥96, the packets that overflow are exactly the full-size ones — the server → client direction — while your client's smaller upstream packets get through. That matches your 0.12 Mbps down / 4.37 Mbps up asymmetry closely. A second candidate with the same signature is RandomTrailers, which internal/amneziawgnet/device.go:53-59 documents as one-sided-fatal: "amneziawg-go's own receive path only accepts an oversized (trailer-padded) packet when the RECEIVING side's own RandomTrailers is also true, so a one-sided setting makes that side's packets start getting silently dropped by the other."

I could not read amneziawg-go's own source in this environment, so I cannot confirm whether it reduces the effective MTU to absorb the configured padding. That is the one thing that decides between "real defect" and "your particular config".

Separately, and independent of all the above: AmneziaWG here is fully userspace — amneziawg-go over a gVisor netstack, then a loopback SOCKS5 hop into Xray (internal/amneziawgnet/relay.go:1-6, internal/web/service/xray.go:748-755). It will never match VLESS/Reality throughput. But 0.12 Mbps is far below any constant-factor overhead, so "userspace is slower" does not explain your numbers.

What I need from you

  1. The inbound's MTU field — empty, or a number? And the actual values of S4, ContentPaddingAddition, HeaderProtectionKey (present/blank), RandomTrailers and DisableCookies on that inbound. As text please.
  2. Which client is connecting — app name, platform and version (AmneziaVPN / AmneziaWG). The 3.1 parameters need a 3.1-capable client; see the warning callout in config/amneziawg.
  3. Do the SOCKS5 associate ... connection refused warnings keep appearing after Xray ... started, or only in that one restart window? If they continue, that is a different and more serious problem than the one above.
  4. The decisive test: set the inbound's MTU to 1280, save, then re-download the client .conf / re-import the share link (an already-imported profile keeps the old settings), reconnect, and re-run the speed test. If download jumps, the padding-vs-MTU interaction is confirmed. If it doesn't move, blank RandomTrailers on the inbound, re-export the config again, and retest.

While testing, the panel Overview's AmneziaWG log view (per-peer Up/Down counters, internal/web/service/server.go:1195-1206) is worth watching: a server-side Down far larger than what the client reports receiving means packets are being sent and dropped in flight, which is what both hypotheses above predict.

Verdict: Insufficient information
Severity: N/A pending the values above; if the MTU/padding derivation holds it is High (default configuration, common path)
Confidence: Medium
Root cause: Not established. Leading candidate: internal/amneziawgnet/device.go:19 defaultMTU = 1420 combined with the per-packet padding internal/amneziawg/params.go:57,70-71,94 enables by default (S4 12–27, ContentPaddingAddition up to 64, RandomTrailers on) while the inbound's MTU field defaults to empty (frontend/src/lib/xray/inbound-defaults.ts:304-322) and no MTU = line reaches the client config (internal/sub/service.go:725-726). Not the log warnings: those are relay.go:108 during the Xray restart window, since the SOCKS5 relay listener lives inside Xray (internal/web/service/xray.go:748-755).
Already fixed: Not applicable — still present on the default branch. internal/amneziawgnet, internal/amneziawg and internal/web/service/inbound_amneziawg.go have exactly one commit in their history, effcccce feat(amneziawg): add native AmneziaWG protocol support (#6105), and git log effcccce..HEAD on those paths is empty. The reporter's dev+f13baa9a is two commits after effcccce, so their AmneziaWG code is byte-identical to tip and to v3.7.0.
Duplicate of: None. Related: #6302 (AmneziaWG outbounds, a feature request — different code path).
Evidence: internal/amneziawgnet/relay.go:108 return nil, fmt.Errorf("amneziawgnet: dial SOCKS5 control connection: %w", err); relay.go:340-346 (no negative caching, so one dial + one warning per datagram); relay.go:78 (the TCP-path warning, absent from the log); internal/amneziawgnet/socks_config.go:12-18 (port = 65100 + inbound id, matching 65107/65105); internal/amneziawgnet/device.go:19,126-128 (defaultMTU = 1420); internal/amneziawgnet/device.go:53-59 (RandomTrailers is one-sided-fatal); internal/amneziawg/params.go:27-36,57,68-71,94; internal/sub/service.go:725-726, 763-764; internal/web/service/xray.go:712-756; frontend/src/lib/xray/inbound-defaults.ts:304-322; frontend/src/lib/xray/amneziawg-obfuscation.ts:104,115,122; docs/content/docs/en/config/amneziawg.mdx:52,64-70.
Not determined: Whether amneziawg-go subtracts the configured S4 / ContentPaddingAddition / RandomTrailers bytes from the effective MTU before emitting a transport packet. Its source is not available in this checkout, and I cannot run or benchmark anything here. Item 4 above (MTU 1280 + re-exported client config) settles it in one test.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5399171078 --> @github-actions[bot] commented on GitHub (Aug 24, 2026): Short version: the `SOCKS5 associate ... connection refused` lines in your log are **not** the cause — they are the Xray restart window. The download collapse is most likely the tunnel MTU versus the AmneziaWG 3.1 per-packet padding the panel enables by default, but I can't confirm that without a few values from your inbound, so I'm asking for them below. First, a note: I can't open images, so I could not read either screenshot. Please paste the values as text. ## The log warnings are a red herring `amneziawgnet: dial SOCKS5 control connection` comes from `internal/amneziawgnet/relay.go:108`, reached only from the UDP path (`UDPRelay.Handle`, `relay.go:342`). It dials the loopback SOCKS5 inbound that lives **inside Xray**: ```go // internal/amneziawgnet/socks_config.go:12,16-18 const SOCKSBasePort = 65100 func SOCKSPortForInbound(inboundID int) int { return SOCKSBasePort + inboundID } ``` So `65107` = inbound 7, `65105` = inbound 5. While Xray is down, that listener does not exist, and `Handle` caches nothing on failure — it re-dials and re-logs for **every** UDP datagram, which is why you get 33 identical lines. In your log every one of them appears *before* `XRAY: core: Xray 26.7.28 started`, so they are all inside one restart window. Note there is no `RelayTCP: SOCKS5 CONNECT` warning (`relay.go:78`), i.e. TCP relaying into Xray was not failing. ## What I suspect is actually throttling the download A new AmneziaWG inbound is created with the **MTU field empty** (`frontend/src/pages/inbounds/form/protocols/amneziawg.tsx:48-50` has no default; `createDefaultAmneziawgInboundSettings` at `frontend/src/lib/xray/inbound-defaults.ts:304-322` never sets `mtu`). With `mtu` unset the embedded interface falls back to: ```go // internal/amneziawgnet/device.go:19,126-128 const defaultMTU = 1420 ... mtu := inst.MTU if mtu <= 0 { mtu = defaultMTU } ``` and the client `.conf` gets no `MTU =` line at all (`internal/sub/service.go:725-726` writes it only `if server.MTU > 0`). Meanwhile the generated 3.1 obfuscation set adds bytes to **every data packet**: ```go // internal/amneziawg/params.go:57,70-71,94 o.S4 = randInt(12, 27) // transport padding, per packet cpLo := randInt(8, 24) o.ContentPaddingAddition = fmt.Sprintf("%d-%d", cpLo, cpLo+randInt(8, 40)) // up to 64 o.RandomTrailers = true ``` (`randInt` is inclusive on both ends — `params.go:27-36`. The frontend generator is identical: `frontend/src/lib/xray/amneziawg-obfuscation.ts:104,115,122`.) The arithmetic I derive from those literals — flagging it as my own derivation, not a repo constant: a 1420-byte inner packet in standard WireGuard framing is 1420 + 32 (type/reserved/receiver/counter + Poly1305 tag) + 8 UDP + 20 IPv4 = **1480 bytes on the wire**, i.e. **20 bytes of headroom** under a 1500-byte path MTU. S4 alone is 12–27 bytes, before ContentPaddingAddition (up to 64) and RandomTrailers. That contradicts what the repo itself asserts in two places: - `internal/amneziawg/params.go:68-69` — `// Total padding stays <= 64: it rides on full-size transport packets, the same MTU headroom that caps S4 at 32.` - `docs/content/docs/en/config/amneziawg.mdx:52` — "Kept `<= 64` by the generator so a 1420-MTU tunnel doesn't fragment." If that headroom really is 20 bytes and not ≥96, the packets that overflow are exactly the full-size ones — the **server → client** direction — while your client's smaller upstream packets get through. That matches your 0.12 Mbps down / 4.37 Mbps up asymmetry closely. A second candidate with the same signature is `RandomTrailers`, which `internal/amneziawgnet/device.go:53-59` documents as one-sided-fatal: *"amneziawg-go's own receive path only accepts an oversized (trailer-padded) packet when the RECEIVING side's own RandomTrailers is also true, so a one-sided setting makes that side's packets start getting silently dropped by the other."* I could not read `amneziawg-go`'s own source in this environment, so I cannot confirm whether it reduces the effective MTU to absorb the configured padding. That is the one thing that decides between "real defect" and "your particular config". Separately, and independent of all the above: AmneziaWG here is fully userspace — amneziawg-go over a gVisor netstack, then a loopback SOCKS5 hop into Xray (`internal/amneziawgnet/relay.go:1-6`, `internal/web/service/xray.go:748-755`). It will never match VLESS/Reality throughput. But 0.12 Mbps is far below any constant-factor overhead, so "userspace is slower" does not explain your numbers. ## What I need from you 1. The inbound's **MTU** field — empty, or a number? And the actual values of **S4**, **ContentPaddingAddition**, **HeaderProtectionKey** (present/blank), **RandomTrailers** and **DisableCookies** on that inbound. As text please. 2. Which client is connecting — app name, platform and **version** (AmneziaVPN / AmneziaWG). The 3.1 parameters need a 3.1-capable client; see the warning callout in [config/amneziawg](https://github.com/MHSanaei/3x-ui/blob/main/docs/content/docs/en/config/amneziawg.mdx). 3. Do the `SOCKS5 associate ... connection refused` warnings keep appearing **after** `Xray ... started`, or only in that one restart window? If they continue, that is a different and more serious problem than the one above. 4. The decisive test: set the inbound's **MTU to 1280**, save, then **re-download the client `.conf` / re-import the share link** (an already-imported profile keeps the old settings), reconnect, and re-run the speed test. If download jumps, the padding-vs-MTU interaction is confirmed. If it doesn't move, blank **RandomTrailers** on the inbound, re-export the config again, and retest. While testing, the panel Overview's AmneziaWG log view (per-peer `Up`/`Down` counters, `internal/web/service/server.go:1195-1206`) is worth watching: a server-side `Down` far larger than what the client reports receiving means packets are being sent and dropped in flight, which is what both hypotheses above predict. Verdict: Insufficient information Severity: N/A pending the values above; if the MTU/padding derivation holds it is High (default configuration, common path) Confidence: Medium Root cause: Not established. Leading candidate: `internal/amneziawgnet/device.go:19` `defaultMTU = 1420` combined with the per-packet padding `internal/amneziawg/params.go:57,70-71,94` enables by default (S4 12–27, ContentPaddingAddition up to 64, RandomTrailers on) while the inbound's MTU field defaults to empty (`frontend/src/lib/xray/inbound-defaults.ts:304-322`) and no `MTU =` line reaches the client config (`internal/sub/service.go:725-726`). Not the log warnings: those are `relay.go:108` during the Xray restart window, since the SOCKS5 relay listener lives inside Xray (`internal/web/service/xray.go:748-755`). Already fixed: Not applicable — still present on the default branch. `internal/amneziawgnet`, `internal/amneziawg` and `internal/web/service/inbound_amneziawg.go` have exactly one commit in their history, effcccce `feat(amneziawg): add native AmneziaWG protocol support (#6105)`, and `git log effcccce..HEAD` on those paths is empty. The reporter's `dev+f13baa9a` is two commits after effcccce, so their AmneziaWG code is byte-identical to tip and to v3.7.0. Duplicate of: None. Related: #6302 (AmneziaWG *outbounds*, a feature request — different code path). Evidence: `internal/amneziawgnet/relay.go:108` `return nil, fmt.Errorf("amneziawgnet: dial SOCKS5 control connection: %w", err)`; `relay.go:340-346` (no negative caching, so one dial + one warning per datagram); `relay.go:78` (the TCP-path warning, absent from the log); `internal/amneziawgnet/socks_config.go:12-18` (port = 65100 + inbound id, matching 65107/65105); `internal/amneziawgnet/device.go:19,126-128` (`defaultMTU = 1420`); `internal/amneziawgnet/device.go:53-59` (RandomTrailers is one-sided-fatal); `internal/amneziawg/params.go:27-36,57,68-71,94`; `internal/sub/service.go:725-726`, `763-764`; `internal/web/service/xray.go:712-756`; `frontend/src/lib/xray/inbound-defaults.ts:304-322`; `frontend/src/lib/xray/amneziawg-obfuscation.ts:104,115,122`; `docs/content/docs/en/config/amneziawg.mdx:52,64-70`. Not determined: Whether amneziawg-go subtracts the configured S4 / ContentPaddingAddition / RandomTrailers bytes from the effective MTU before emitting a transport packet. Its source is not available in this checkout, and I cannot run or benchmark anything here. Item 4 above (MTU 1280 + re-exported client config) settles it in one test. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@letsnotencrypt commented on GitHub (Aug 24, 2026):

same, with multiple [TUN] [********] Received packet with invalid mac1 in logs
amneziawg client 3.1.0v. with awg3.1 support

<!-- gh-comment-id:5399404623 --> @letsnotencrypt commented on GitHub (Aug 24, 2026): same, with multiple [TUN] [********] Received packet with invalid mac1 in logs amneziawg client 3.1.0v. with awg3.1 support
Author
Owner

@egorbr4z commented on GitHub (Aug 24, 2026):

It fixed it for me when I removed the forced MTU value

<!-- gh-comment-id:5399626420 --> @egorbr4z commented on GitHub (Aug 24, 2026): It fixed it for me when I removed the forced MTU value
Author
Owner

@shoei1944 commented on GitHub (Aug 24, 2026):

i try null and 1480/1280 mtu, it doesnt help me

<!-- gh-comment-id:5399699260 --> @shoei1944 commented on GitHub (Aug 24, 2026): i try null and 1480/1280 mtu, it doesnt help me
Author
Owner

@letsnotencrypt commented on GitHub (Aug 24, 2026):

disabling the RandomTrailers option under the Protocol settings helped me significantly increase the bandwidth, as well as get rid of the "Packet received with invalid mac1" errors. DisableCookies can still cause some log failures from time to time.

<!-- gh-comment-id:5399884585 --> @letsnotencrypt commented on GitHub (Aug 24, 2026): disabling the RandomTrailers option under the Protocol settings helped me significantly increase the bandwidth, as well as get rid of the "Packet received with invalid mac1" errors. DisableCookies can still cause some log failures from time to time.
Author
Owner

@shoei1944 commented on GitHub (Aug 24, 2026):

Image
<!-- gh-comment-id:5400269561 --> @shoei1944 commented on GitHub (Aug 24, 2026): <img width="1039" height="503" alt="Image" src="https://github.com/user-attachments/assets/76675474-48e4-475e-a19c-c708f6ecdf4b" />
Author
Owner

@mikop63 commented on GitHub (Aug 24, 2026):

AmneziaWG connection is established intermittently, but websites do not load

I am unable to establish a working AmneziaWG connection. Sometimes the connection appears to be established, but websites still do not load.

Configuration in 3x-ui:

{
  "listen": "",
  "port": 20471,
  "protocol": "amneziawg",
  "tag": "in-20370-udp",
  "settings": {
    "clients": [
      {
        "privateKey": "WI1****IHQ=",
        "publicKey": "BsB*****LFg=",
        "allowedIPs": [
          "10.8.1.3/32"
        ],
        "forwardedPorts": "",
        "email": "Phone",
        "limitIp": 0,
        "totalGB": 0,
        "expiryTime": 0,
        "enable": true,
        "tgId": 0,
        "subId": "02e25",
        "comment": "",
        "reset": 0,
        "created_at": 1764434839000,
        "updated_at": 1787603518000
      }
    ],
    "server": {
      "contentPaddingAddition": "16-41",
      "disableCookies": false,
      "h1": "399420764-495343907",
      "h2": "1065641237-1070313200",
      "h3": "1503703117-1536089129",
      "h4": "1738996074-2078624678",
      "headerProtectionKey": "OJxmQVGlk=",
      "i1": "<r 194>",
      "jc": 3,
      "jmax": 108,
      "jmin": 52,
      "keepaliveTimeout": "8-13",
      "maxHandshakeAttempts": "17-26",
      "mtu": 1480,
      "primaryDns": "8.8.8.8",
      "privateKey": "2Or****uGU=",
      "publicKey": "xsxp****D/Sk=",
      "randomTrailers": false,
      "rejectAfterTime": "178-214",
      "rekeyAfterTime": "104-140",
      "rekeyTimeout": "6-7",
      "s1": 88,
      "s2": 73,
      "s3": 45,
      "s4": 19,
      "secondaryDns": "8.8.4.4",
      "subnetCidr": 24,
      "subnetIp": "10.8.1.0"
    }
  }
}

Logs from the Amnezia application:

2026-08-25 01:16:37 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:04:43 +0000
2026-08-25 01:16:37 debug NE: WG: DNS64: mapped 185.223.82.106 to itself.
2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h1 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h2 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h3 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h4 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s1 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s2 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s3 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s4 padding
2026-08-25 01:16:37 debug NE: WG: UAPI: Updating header protection key
2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v4 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - started
2026-08-25 01:16:37 info NE: WG: Stopping tunnel: reason: The user stopped the NE
2026-08-25 01:16:37 debug NE: WG: Adapter stop requested (state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator))
2026-08-25 01:16:37 debug NE: WG: Device closing
2026-08-25 01:16:37 debug NE: WG: Routine: TUN reader - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: event worker - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v4 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - stopped
2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - Stopping
2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential sender - stoppeded
2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 4 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 2 - stopped
2026-08-25 01:16:37 debug NE: WG: Device closed
2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 5 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 1 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 4 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 2 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 3 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 1 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 6 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 5 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 5 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 1 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 6 - stopped
2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 3 - stopped
2026-08-25 01:17:45 info NE: Start tunnel
2026-08-25 01:17:45 info NE: ProtocolincludeAllNetworks=false excludeLocalNetworks=true
2026-08-25 01:17:45 info NE: ProtocolbundleId=org.amnezia.AmneziaVPN.network-extension keys=[wireguard]
2026-08-25 01:17:45 info NE: WG: Starting tunnel from the OS directly, rather than the app
2026-08-25 01:17:45 debug NE: WG: Adapter start requested
2026-08-25 01:17:45 debug NE: WG: Resolved endpoints (start): ["185.223.82.106:20370"]
2026-08-25 01:17:45 debug NE: WG: Network settings (start): remote=127.0.0.1 mtu=1480 dns=8.8.8.8, 8.8.4.4 ipv4 inc/exc=2/1 ipv6 inc/exc=1/0
2026-08-25 01:17:45 debug NE: WG: setNetworkSettings: applying
2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself.
2026-08-25 01:17:45 debug NE: WG: Starting WireGuard backend (config bytes: 690, fd: 5)
2026-08-25 01:17:45 debug NE: WG: Attaching to interface
2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 4 - started
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 1 - started
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk count
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk min
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk max
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating content padding addition
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating rekey after time
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 5 - started
2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 5 - started
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating rekey timeout- started
2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 4 - started
2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 5 - started
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating keepalive timeout
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating max handshake attempts
2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 6 - started
2026-08-25 01:17:45 debug NE: WG: UAPI: Removing all peers
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 2 - started
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 6 - started
2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 1 - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Created
2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 3 - started
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 3 - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint
2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 6 - started
2026-08-25 01:17:45 debug NE: WG: Routine: TUN reader - started
2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 4 - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating persistent keepalive interval
2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 3 - started
2026-08-25 01:17:45 debug NE: WG: Routine: event worker - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Removing all allowedips
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Adding allowedip
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Adding allowedip
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Starting
2026-08-25 01:17:45 debug NE: WG: Interface state was Down, requested Up, now Up
2026-08-25 01:17:45 debug NE: WG: Device started
2026-08-25 01:17:45 debug NE: WG: WireGuard backend started with handle 0
2026-08-25 01:17:45 info NE: WG: Tunnel interface is utun38
2026-08-25 01:17:45 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0]
2026-08-25 01:17:45 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000
2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself.
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key
2026-08-25 01:17:45 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0, utun38]
2026-08-25 01:17:45 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000
2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself.
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding
2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential sender - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential receiver - started
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - stopped
2026-08-25 01:17:45 debug NE: WG: UDP bind has been updated
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - started
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - stopped
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - stopped
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - started
2026-08-25 01:17:45 debug NE: WG: UDP bind has been updated
2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started
2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:17:46 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:47 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:48 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:49 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:50 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:51 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:52 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:17:52 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:53 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:54 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:55 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:56 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:57 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:58 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:17:58 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:17:59 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:00 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:01 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:02 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:03 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:04 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 6 seconds, retrying (try 2)
2026-08-25 01:18:04 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:04 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:05 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:06 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:07 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:08 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:09 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:10 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:10 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:11 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:12 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:13 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:14 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:15 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:16 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:16 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 6 seconds, retrying (try 2)
2026-08-25 01:18:16 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:17 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:18 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:19 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:20 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:21 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:22 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:23 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:23 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:24 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:25 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:18:30 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 7 seconds, retrying (try 2)
2026-08-25 01:18:30 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:36 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:43 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:49 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:18:55 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:19:01 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:19:02 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation
2026-08-25 01:19:03 info NE: App said: {"tunnelId":"","action":"status"}
2026-08-25 01:19:04 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0]
2026-08-25 01:19:04 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000
2026-08-25 01:19:04 debug NE: WG: DNS64: mapped 185.223.82.106 to itself.
2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h1 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h2 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h3 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h4 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s1 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s2 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s3 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s4 padding
2026-08-25 01:19:04 debug NE: WG: UAPI: Updating header protection key
2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v4 - stopped
2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v6 - started
2026-08-25 01:19:04 info NE: WG: Stopping tunnel: reason: The user stopped the NE
2026-08-25 01:19:04 debug NE: WG: Adapter stop requested (state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator))
2026-08-25 01:19:04 debug NE: WG: Device closing
2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v6 - stopped
2026-08-25 01:19:04 debug NE: WG: Routine: TUN reader - stopped
2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - Stopping
2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential receiver - stopped

I have tried the following:

  • Setting the MTU manually and leaving it unset.
  • Enabling and disabling RandomTrailers.
  • Enabling and disabling DisableCookies.

None of these changes resolved the issue. The connection may occasionally appear to be established, but I still cannot open any websites.

<!-- gh-comment-id:5401589318 --> @mikop63 commented on GitHub (Aug 24, 2026): AmneziaWG connection is established intermittently, but websites do not load I am unable to establish a working AmneziaWG connection. Sometimes the connection appears to be established, but websites still do not load. Configuration in 3x-ui: ```json { "listen": "", "port": 20471, "protocol": "amneziawg", "tag": "in-20370-udp", "settings": { "clients": [ { "privateKey": "WI1****IHQ=", "publicKey": "BsB*****LFg=", "allowedIPs": [ "10.8.1.3/32" ], "forwardedPorts": "", "email": "Phone", "limitIp": 0, "totalGB": 0, "expiryTime": 0, "enable": true, "tgId": 0, "subId": "02e25", "comment": "", "reset": 0, "created_at": 1764434839000, "updated_at": 1787603518000 } ], "server": { "contentPaddingAddition": "16-41", "disableCookies": false, "h1": "399420764-495343907", "h2": "1065641237-1070313200", "h3": "1503703117-1536089129", "h4": "1738996074-2078624678", "headerProtectionKey": "OJxmQVGlk=", "i1": "<r 194>", "jc": 3, "jmax": 108, "jmin": 52, "keepaliveTimeout": "8-13", "maxHandshakeAttempts": "17-26", "mtu": 1480, "primaryDns": "8.8.8.8", "privateKey": "2Or****uGU=", "publicKey": "xsxp****D/Sk=", "randomTrailers": false, "rejectAfterTime": "178-214", "rekeyAfterTime": "104-140", "rekeyTimeout": "6-7", "s1": 88, "s2": 73, "s3": 45, "s4": 19, "secondaryDns": "8.8.4.4", "subnetCidr": 24, "subnetIp": "10.8.1.0" } } } ``` Logs from the Amnezia application: ```text 2026-08-25 01:16:37 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:04:43 +0000 2026-08-25 01:16:37 debug NE: WG: DNS64: mapped 185.223.82.106 to itself. 2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h1 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h2 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h3 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating h4 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s1 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s2 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s3 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating s4 padding 2026-08-25 01:16:37 debug NE: WG: UAPI: Updating header protection key 2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v4 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - started 2026-08-25 01:16:37 info NE: WG: Stopping tunnel: reason: The user stopped the NE 2026-08-25 01:16:37 debug NE: WG: Adapter stop requested (state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator)) 2026-08-25 01:16:37 debug NE: WG: Device closing 2026-08-25 01:16:37 debug NE: WG: Routine: TUN reader - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: event worker - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v4 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: receive incoming v6 - stopped 2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - Stopping 2026-08-25 01:16:37 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential sender - stoppeded 2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 4 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 2 - stopped 2026-08-25 01:16:37 debug NE: WG: Device closed 2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 5 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 1 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 4 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 2 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 3 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: decryption worker 1 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 6 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: handshake worker 5 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 5 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 1 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 6 - stopped 2026-08-25 01:16:37 debug NE: WG: Routine: encryption worker 3 - stopped 2026-08-25 01:17:45 info NE: Start tunnel 2026-08-25 01:17:45 info NE: ProtocolincludeAllNetworks=false excludeLocalNetworks=true 2026-08-25 01:17:45 info NE: ProtocolbundleId=org.amnezia.AmneziaVPN.network-extension keys=[wireguard] 2026-08-25 01:17:45 info NE: WG: Starting tunnel from the OS directly, rather than the app 2026-08-25 01:17:45 debug NE: WG: Adapter start requested 2026-08-25 01:17:45 debug NE: WG: Resolved endpoints (start): ["185.223.82.106:20370"] 2026-08-25 01:17:45 debug NE: WG: Network settings (start): remote=127.0.0.1 mtu=1480 dns=8.8.8.8, 8.8.4.4 ipv4 inc/exc=2/1 ipv6 inc/exc=1/0 2026-08-25 01:17:45 debug NE: WG: setNetworkSettings: applying 2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself. 2026-08-25 01:17:45 debug NE: WG: Starting WireGuard backend (config bytes: 690, fd: 5) 2026-08-25 01:17:45 debug NE: WG: Attaching to interface 2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 4 - started 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 1 - started 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk count 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk min 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating junk max 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating content padding addition 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating rekey after time 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 5 - started 2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 5 - started 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating rekey timeout- started 2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 4 - started 2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 5 - started 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating keepalive timeout 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating max handshake attempts 2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 6 - started 2026-08-25 01:17:45 debug NE: WG: UAPI: Removing all peers 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 2 - started 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 6 - started 2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 1 - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Created 2026-08-25 01:17:45 debug NE: WG: Routine: decryption worker 3 - started 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 3 - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint 2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 6 - started 2026-08-25 01:17:45 debug NE: WG: Routine: TUN reader - started 2026-08-25 01:17:45 debug NE: WG: Routine: encryption worker 4 - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating persistent keepalive interval 2026-08-25 01:17:45 debug NE: WG: Routine: handshake worker 3 - started 2026-08-25 01:17:45 debug NE: WG: Routine: event worker - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Removing all allowedips 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Adding allowedip 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Adding allowedip 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Starting 2026-08-25 01:17:45 debug NE: WG: Interface state was Down, requested Up, now Up 2026-08-25 01:17:45 debug NE: WG: Device started 2026-08-25 01:17:45 debug NE: WG: WireGuard backend started with handle 0 2026-08-25 01:17:45 info NE: WG: Tunnel interface is utun38 2026-08-25 01:17:45 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0] 2026-08-25 01:17:45 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000 2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself. 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key 2026-08-25 01:17:45 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0, utun38] 2026-08-25 01:17:45 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000 2026-08-25 01:17:45 debug NE: WG: DNS64: mapped 185.223.82.106 to itself. 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating h4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s1 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s2 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s3 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating s4 padding 2026-08-25 01:17:45 debug NE: WG: UAPI: Updating header protection key 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential sender - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential receiver - started 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - stopped 2026-08-25 01:17:45 debug NE: WG: UDP bind has been updated 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - started 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - stopped 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - stopped 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v4 - started 2026-08-25 01:17:45 debug NE: WG: UDP bind has been updated 2026-08-25 01:17:45 debug NE: WG: Routine: receive incoming v6 - started 2026-08-25 01:17:45 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:17:46 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:47 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:48 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:49 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:50 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:51 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:52 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:17:52 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:53 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:54 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:55 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:56 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:57 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:58 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:17:58 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:17:59 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:00 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:01 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:02 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:03 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:04 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 6 seconds, retrying (try 2) 2026-08-25 01:18:04 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:04 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:05 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:06 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:07 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:08 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:09 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:10 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:10 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:11 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:12 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:13 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:14 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:15 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:16 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:16 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 6 seconds, retrying (try 2) 2026-08-25 01:18:16 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:17 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:18 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:19 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:20 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:21 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:22 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:23 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:23 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:24 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:25 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:18:30 debug NE: WG: peer(xsxp…D/Sk) - Handshake did not complete after 7 seconds, retrying (try 2) 2026-08-25 01:18:30 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:36 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:43 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:49 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:18:55 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:19:01 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:19:02 debug NE: WG: peer(xsxp…D/Sk) - Sending handshake initiation 2026-08-25 01:19:03 info NE: App said: {"tunnelId":"","action":"status"} 2026-08-25 01:19:04 debug NE: WG: Network change detected with satisfied route and interface order [pdp_ip0] 2026-08-25 01:19:04 debug NE: WG: Path update state: state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator) everHadHandshake=false lastNetworkSettingsUpdateAt=2026-08-24 21:17:45 +0000 2026-08-25 01:19:04 debug NE: WG: DNS64: mapped 185.223.82.106 to itself. 2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - UAPI: Updating endpoint 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h1 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h2 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h3 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating h4 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s1 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s2 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s3 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating s4 padding 2026-08-25 01:19:04 debug NE: WG: UAPI: Updating header protection key 2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v4 - stopped 2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v6 - started 2026-08-25 01:19:04 info NE: WG: Stopping tunnel: reason: The user stopped the NE 2026-08-25 01:19:04 debug NE: WG: Adapter stop requested (state=started(0, AmneziaVPNNetworkExtension.PacketTunnelSettingsGenerator)) 2026-08-25 01:19:04 debug NE: WG: Device closing 2026-08-25 01:19:04 debug NE: WG: Routine: receive incoming v6 - stopped 2026-08-25 01:19:04 debug NE: WG: Routine: TUN reader - stopped 2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - Stopping 2026-08-25 01:19:04 debug NE: WG: peer(xsxp…D/Sk) - Routine: sequential receiver - stopped ``` I have tried the following: * Setting the MTU manually and leaving it unset. * Enabling and disabling `RandomTrailers`. * Enabling and disabling `DisableCookies`. None of these changes resolved the issue. The connection may occasionally appear to be established, but I still cannot open any websites.
Author
Owner

@mr-darkwing-duck commented on GitHub (Aug 24, 2026):

confirmed:

AWG 10 mbit
VLESS 300 mbit

same VPS, same client

<!-- gh-comment-id:5401707573 --> @mr-darkwing-duck commented on GitHub (Aug 24, 2026): confirmed: AWG 10 mbit VLESS 300 mbit same VPS, same client
Author
Owner

@letsnotencrypt commented on GitHub (Aug 24, 2026):

i tried it on my second work stand with a fresh x-ui installation and met the same conditions.

Image Image
<!-- gh-comment-id:5402269221 --> @letsnotencrypt commented on GitHub (Aug 24, 2026): i tried it on my second work stand with a fresh x-ui installation and met the same conditions. <img width="920" height="98" alt="Image" src="https://github.com/user-attachments/assets/5f4869d3-aacf-4d1d-8da8-dbb41204fa4b" /> <img width="1023" height="109" alt="Image" src="https://github.com/user-attachments/assets/0622df6d-84d9-4bda-bfe2-f71fa4178b82" />
Author
Owner

@shoei1944 commented on GitHub (Aug 24, 2026):

iperf3 test

Image
<!-- gh-comment-id:5402602491 --> @shoei1944 commented on GitHub (Aug 24, 2026): iperf3 test <img width="1044" height="604" alt="Image" src="https://github.com/user-attachments/assets/cb76a3d7-446d-4720-ac2b-55d2edf5928b" />
Author
Owner

@MarketTwits commented on GitHub (Aug 25, 2026):

Reproduced on 3x-ui 3.7.0. Same VPS/client: VLESS and native AWG are fast, but 3x-ui AmneziaWG download is much slower. MTU 1280 improved upload only. RandomTrailers off, ContentPaddingAddition disabled, S4=12 and DisableCookies off did not improve download. CPU load stays normal during the test.

<!-- gh-comment-id:5404046155 --> @MarketTwits commented on GitHub (Aug 25, 2026): Reproduced on 3x-ui 3.7.0. Same VPS/client: VLESS and native AWG are fast, but 3x-ui AmneziaWG download is much slower. MTU 1280 improved upload only. RandomTrailers off, ContentPaddingAddition disabled, S4=12 and DisableCookies off did not improve download. CPU load stays normal during the test.
Author
Owner

@kuzzrus commented on GitHub (Aug 25, 2026):

Image Image

Traced this to a specific field, with a clean isolation test. Two separate findings, since they overlap in this thread:

Finding 1: MTU overflow (real, but only explains part of the gap)

S4 (unlike S1/S2) prefixes every transport/data packet, not just the handshake — amneziawg-go's uapi.go stores it into paddings.transport. Wire size of one full packet is MTU + 32 (transport header + poly1305 tag) + S4 + 8 (UDP) + 20 (IPv4). With a 1420-1428 MTU and S4 in the high teens/20s (well within this fork's/the panel's generated range), that overflows a 1500-byte path MTU, WireGuard sets DF, and the oversized direction (mostly server→client) just drops. Lowering MTU to 1280 fixed the asymmetry but didn't get us anywhere near native speeds — which led to finding 2.

Finding 2: RandomTrailers (the dominant factor, isolated field-by-field)

Same VPS, same client app, same MTU (1280), same S1-S4, only the listed field changed each round:

HeaderProtectionKey ContentPaddingAddition RandomTrailers DisableCookies Down/Up (Mbps)
set set (18-64ish) on on ~15 / ~2
set set (22-95) off on ~138 / ~196
empty set (30-130) on on ~14 / ~17
empty set (30-130) off on ~14 / ~17 → good*

(*third and fourth row: clearing HeaderProtectionKey alone changed nothing; flipping only RandomTrailers off on top of that fixed it. A follow-up round restored HeaderProtectionKey with RandomTrailers still off and speed stayed good — so HeaderProtectionKey doesn't correlate with throughput at all, only RandomTrailers does.)

This matches @MarketTwits' report of RandomTrailers/S4/ContentPaddingAddition/DisableCookies not moving the needle -- but note their combination didn't isolate RandomTrailers alone from HeaderProtectionKey, since HeaderProtectionKey wasn't mentioned as cleared in their test. Once isolated, RandomTrailers is the whole effect.

We can't yet explain this from the source. In device/send.go, randomPaddingAddition (driven by ContentPaddingAddition) is checked before peer.randomTrailer, and returns non-negative whenever ContentPaddingAddition is set — so by that precedence, RandomTrailers shouldn't touch data packets at all once padding is configured, only the three handshake message types. Whatever's actually happening doesn't match that reading.

Ruled out along the way, in case it saves someone a round: (SendHandshakeCookie's make([]byte, len, cap) bug) is unrelated here — already fixed as of v3.1.20260814, and moot regardless since SendHandshakeCookie returns immediately when DisableCookies is set (true in every row above).

Environment: 3x-ui fork with embedded amneziawg-go (gVisor netstack + SOCKS5 relay into Xray, not a kernel module), github.com/amnezia-vpn/amneziawg-go/v3 v3.1.20260814, Windows AmneziaVPN desktop client.

<!-- gh-comment-id:5408354320 --> @kuzzrus commented on GitHub (Aug 25, 2026): <img width="771" height="689" alt="Image" src="https://github.com/user-attachments/assets/ec16e374-dcf1-4d6c-bfa0-fabcfc7a2680" /> <img width="743" height="278" alt="Image" src="https://github.com/user-attachments/assets/921840df-56cd-4f41-9a50-ced2f7453f78" /> Traced this to a specific field, with a clean isolation test. Two separate findings, since they overlap in this thread: ## Finding 1: MTU overflow (real, but only explains part of the gap) `S4` (unlike `S1`/`S2`) prefixes every transport/data packet, not just the handshake — `amneziawg-go`'s `uapi.go` stores it into `paddings.transport`. Wire size of one full packet is `MTU + 32 (transport header + poly1305 tag) + S4 + 8 (UDP) + 20 (IPv4)`. With a 1420-1428 MTU and `S4` in the high teens/20s (well within this fork's/the panel's generated range), that overflows a 1500-byte path MTU, WireGuard sets DF, and the oversized direction (mostly server→client) just drops. Lowering MTU to 1280 fixed the asymmetry but didn't get us anywhere near native speeds — which led to finding 2. ## Finding 2: `RandomTrailers` (the dominant factor, isolated field-by-field) Same VPS, same client app, same MTU (1280), same `S1`-`S4`, only the listed field changed each round: | `HeaderProtectionKey` | `ContentPaddingAddition` | `RandomTrailers` | `DisableCookies` | Down/Up (Mbps) | |---|---|---|---|---| | set | set (18-64ish) | **on** | on | ~15 / ~2 | | set | set (22-95) | **off** | on | ~138 / ~196 | | empty | set (30-130) | **on** | on | ~14 / ~17 | | empty | set (30-130) | **off** | on | ~14 / ~17 → good* | (*third and fourth row: clearing `HeaderProtectionKey` alone changed nothing; flipping only `RandomTrailers` off on top of that fixed it. A follow-up round restored `HeaderProtectionKey` with `RandomTrailers` still off and speed stayed good — so `HeaderProtectionKey` doesn't correlate with throughput at all, only `RandomTrailers` does.) This matches @MarketTwits' report of RandomTrailers/S4/ContentPaddingAddition/DisableCookies not moving the needle -- but note their combination didn't isolate `RandomTrailers` alone from `HeaderProtectionKey`, since `HeaderProtectionKey` wasn't mentioned as cleared in their test. Once isolated, `RandomTrailers` is the whole effect. **We can't yet explain this from the source.** In `device/send.go`, `randomPaddingAddition` (driven by `ContentPaddingAddition`) is checked *before* `peer.randomTrailer`, and returns non-negative whenever `ContentPaddingAddition` is set — so by that precedence, `RandomTrailers` shouldn't touch data packets at all once padding is configured, only the three handshake message types. Whatever's actually happening doesn't match that reading. Ruled out along the way, in case it saves someone a round: (`SendHandshakeCookie`'s `make([]byte, len, cap)` bug) is unrelated here — already fixed as of `v3.1.20260814`, and moot regardless since `SendHandshakeCookie` returns immediately when `DisableCookies` is set (true in every row above). Environment: 3x-ui fork with embedded `amneziawg-go` (gVisor netstack + SOCKS5 relay into Xray, not a kernel module), `github.com/amnezia-vpn/amneziawg-go/v3 v3.1.20260814`, Windows AmneziaVPN desktop client.
Author
Owner

@shoei1944 commented on GitHub (Aug 25, 2026):

@bazaproject
DNS не влияет на скорость Клиент <-> Сервер

<!-- gh-comment-id:5409214243 --> @shoei1944 commented on GitHub (Aug 25, 2026): @bazaproject DNS не влияет на скорость Клиент <-> Сервер
Author
Owner

@shoei1944 commented on GitHub (Aug 25, 2026):

@kuzzrus
Поставив ваши параметры AmneziaWG я смог добится адекватной скорости (166/166)
Но улетает нагрузка на ЦП сервера до 70%
Дополнение: На iOS все работает, на ПК также обычный веб работает, но любой speedtest показывает чушь

By setting your AmneziaWG parameters, I was able to achieve adequate speed (166/166)
But the server CPU load to 70%
Addition: Everything works on iOS, and the regular web works on a PC, but any speedtest shows nonsense.

Speedtest: https://www.speedtest.net/result/i/7207354382

Image Image
<!-- gh-comment-id:5409396157 --> @shoei1944 commented on GitHub (Aug 25, 2026): @kuzzrus Поставив ваши параметры AmneziaWG я смог добится адекватной скорости (166/166) Но улетает нагрузка на ЦП сервера до 70% Дополнение: На iOS все работает, на ПК также обычный веб работает, но любой speedtest показывает чушь By setting your AmneziaWG parameters, I was able to achieve adequate speed (166/166) But the server CPU load to 70% Addition: Everything works on iOS, and the regular web works on a PC, but any speedtest shows nonsense. Speedtest: https://www.speedtest.net/result/i/7207354382 <img width="317" height="215" alt="Image" src="https://github.com/user-attachments/assets/557f60fc-da63-4ffa-bc91-3d1b3f7eebab" /> <img width="618" height="675" alt="Image" src="https://github.com/user-attachments/assets/30aa33c3-6786-4e33-a1fb-57cb39570342" />
Author
Owner

@alekskomp commented on GitHub (Aug 25, 2026):

This is default server config from native AmneziaVPN docker container:

cat /opt/amnezia/awg/awg0.conf

[Interface]
PrivateKey = +O1SL+3kc+o3v9wbMTGC2qy/f7+YmVBcQWHM1disCFE=
Address = 10.8.1.0/24
ListenPort = 39151
Jc = 5
Jmin = 10
Jmax = 50
S1 = 42
S2 = 108
S3 = 13
S4 = 12
H1 = 1
H2 = 2
H3 = 3
H4 = 4
HeaderProtectionKey = 8dSgJisVIRxIyvKM3XwhoSL/vKI4zxPF/QvEdezDwcM=
ContentPaddingAddition = 10-100
RekeyAfterTime = 100-120
RekeyTimeout = 3-7
RejectAfterTime = 150-180
KeepaliveTimeout = 5-15
MaxHandshakeAttempts = 15-20
RandomTrailers = on
DisableCookies = on
[Peer]
PublicKey = 3XvEuk45+Ov43UJXyws08M8Ro/uh7eW9N0/x5en6IRI=
PresharedKey = iZ8N+W/JCEulTrgszfTezYjriq2+ijx8lJfCB7hyN40=
AllowedIPs = 10.8.1.1/32

Latest native AmneziaVPN server in docker works fine with AmneziaWG v3.1.20260814 client on android.
But got slow speed with this config on 3x-ui server.
RandomTrailers = off with 3x-ui server fixes speed issue

<!-- gh-comment-id:5410254989 --> @alekskomp commented on GitHub (Aug 25, 2026): This is default server config from native AmneziaVPN docker container: > cat /opt/amnezia/awg/awg0.conf ``` [Interface] PrivateKey = +O1SL+3kc+o3v9wbMTGC2qy/f7+YmVBcQWHM1disCFE= Address = 10.8.1.0/24 ListenPort = 39151 Jc = 5 Jmin = 10 Jmax = 50 S1 = 42 S2 = 108 S3 = 13 S4 = 12 H1 = 1 H2 = 2 H3 = 3 H4 = 4 HeaderProtectionKey = 8dSgJisVIRxIyvKM3XwhoSL/vKI4zxPF/QvEdezDwcM= ContentPaddingAddition = 10-100 RekeyAfterTime = 100-120 RekeyTimeout = 3-7 RejectAfterTime = 150-180 KeepaliveTimeout = 5-15 MaxHandshakeAttempts = 15-20 RandomTrailers = on DisableCookies = on [Peer] PublicKey = 3XvEuk45+Ov43UJXyws08M8Ro/uh7eW9N0/x5en6IRI= PresharedKey = iZ8N+W/JCEulTrgszfTezYjriq2+ijx8lJfCB7hyN40= AllowedIPs = 10.8.1.1/32 ``` Latest native AmneziaVPN server in docker works fine with AmneziaWG `v3.1.20260814` client on android. But got slow speed with this config on 3x-ui server. `RandomTrailers = off` with 3x-ui server fixes speed issue
Author
Owner

@kuzzrus commented on GitHub (Aug 25, 2026):

Follow-up to my earlier comment — root cause found, fix shipped and verified on two real servers.

Root cause of the RandomTrailers effect

amneziawg-go's DeterminePacketTypeAndPadding (device/receive.go) tests incoming packets against the H1/H2/H3 handshake ranges before it tests them as transport. With RandomTrailers enabled, those three tests relax from == to > (a trailer makes a handshake message longer than its fixed size) — but a full-size transport packet is also longer than any handshake message, so the relaxed test matches it too. The only thing left distinguishing a data packet from a handshake at that point is the H-range check on 4 ciphertext bytes — uniformly random from an observer's (and the classifier's) point of view. A wide H-range therefore steals a proportional fraction of every transport packet, silently, with no counter or log line.

This was independently found and filed the same day by another author, with a synthetic-packet regression test proving it: amnezia-vpn/amneziawg-go#183 ("~3.5% of transport packets misclassified as handshakes" with their ~50M-wide example ranges).

Why this fork's default made it so much worse than 3.5%

This fork's own H1-H4 generator (internal/amneziawg/params.go, both the Go copy and a duplicate in frontend/.../InboundFormModal.tsx's "Regenerate" button) picked a random range per field, with only a minimum width enforced — no maximum. Checking the actual value that was live on my own test inbound during this investigation:

h1: 50201255-496494940   -> width 446,293,685  (~10.4% of 2^32)
h2: 731340858-921841096  -> width 190,500,238  (~4.4%)
h3: 1436032230-1443368255 -> width   7,336,025  (~0.17%)

H1+H2+H3 alone (the three ranges checked before transport) sum to ~15% of the address space — i.e. roughly 15% of transport packets misclassified and dropped, about 4x worse than the reference case in amneziawg-go#183. That tracks with the severity in this thread (0.12 Mbps, 10 Mbit vs 300, etc.) far better than a flat "3.5%" would.

@alekskomp's own posted native-Amnezia-Docker config in this thread is a clean, independent confirmation from the other direction: it uses H1 = 1, H2 = 2, H3 = 3, H4 = 4 — literal single values, zero range width — with RandomTrailers = on, and reportedly works fine. A range costs nothing on the wire (an observer only ever sees the same random ciphertext bytes regardless of how wide the receiver's acceptance window is), so a single value is strictly safer than any range, with no obfuscation trade-off.

Live-tested fix

Narrowing only H1-H4 on an already-broken inbound (RandomTrailers, ContentPaddingAddition, everything else held constant) took upload from 2-3 Mbit/s to 200+ Mbit/s on my test VPS, single-variable, no other change. Confirmed a second time on a real production box: same treatment took it from a flat ~20 Mbit/s to 120-156 Mbit/s across several runs, in line with the other direction on the same box.

Separately, I found and fixed an undersized shared outbound packet queue (internal/amneziawgnet, the gVisor channel.Endpoint between the netstack and the WireGuard device) that silently drops packets under several concurrent TCP connections' simultaneous slow-start growth — confirmed via a debug endpoint exposing gVisor's own stack.Stats() counters live during a real multi-connection transfer. This is a separate contributor to "AmneziaWG is slower than VLESS/native" specifically on the download side, independent of RandomTrailers.

Both fixes are shipped on my fork (kuzzrus/3x-ui-awg, v3.7.0-awg.7):

  • H1-H4 generator now emits one single value per field instead of a range (both the Go backend's GenerateObfuscation20 and the frontend's independent regenInboundAwgObfuscation copy — both needed the fix separately, since the frontend port had silently dropped the width cap the Go version originally had, and is the code path the panel's actual "Regenerate" button goes through).
  • Packet queue depth raised (1024 → 8192) to absorb multi-connection bursts without dropping.

Since #6105 merged this fork's AmneziaWG implementation upstream, both of these likely affect main here too — happy to open a PR with both fixes (H1-H4 single-value generation in both places, queue depth) if that's useful.

<!-- gh-comment-id:5416975120 --> @kuzzrus commented on GitHub (Aug 25, 2026): Follow-up to my [earlier comment](https://github.com/MHSanaei/3x-ui/issues/6303#issuecomment-5408354320) — root cause found, fix shipped and verified on two real servers. ## Root cause of the `RandomTrailers` effect `amneziawg-go`'s `DeterminePacketTypeAndPadding` (`device/receive.go`) tests incoming packets against the H1/H2/H3 handshake ranges before it tests them as transport. With `RandomTrailers` enabled, those three tests relax from `==` to `>` (a trailer makes a handshake message longer than its fixed size) — but a full-size *transport* packet is also longer than any handshake message, so the relaxed test matches it too. The only thing left distinguishing a data packet from a handshake at that point is the H-range check on 4 ciphertext bytes — uniformly random from an observer's (and the classifier's) point of view. A wide H-range therefore steals a proportional fraction of *every transport packet*, silently, with no counter or log line. This was independently found and filed the same day by another author, with a synthetic-packet regression test proving it: [amnezia-vpn/amneziawg-go#183](https://github.com/amnezia-vpn/amneziawg-go/issues/183) ("~3.5% of transport packets misclassified as handshakes" with their ~50M-wide example ranges). ## Why this fork's default made it so much worse than 3.5% This fork's own H1-H4 generator (`internal/amneziawg/params.go`, both the Go copy and a duplicate in `frontend/.../InboundFormModal.tsx`'s "Regenerate" button) picked a random *range* per field, with only a minimum width enforced — no maximum. Checking the actual value that was live on my own test inbound during this investigation: ``` h1: 50201255-496494940 -> width 446,293,685 (~10.4% of 2^32) h2: 731340858-921841096 -> width 190,500,238 (~4.4%) h3: 1436032230-1443368255 -> width 7,336,025 (~0.17%) ``` H1+H2+H3 alone (the three ranges checked before transport) sum to **~15% of the address space** — i.e. roughly **15% of transport packets misclassified and dropped**, about 4x worse than the reference case in amneziawg-go#183. That tracks with the severity in this thread (0.12 Mbps, 10 Mbit vs 300, etc.) far better than a flat "3.5%" would. @alekskomp's own posted native-Amnezia-Docker config in this thread is a clean, independent confirmation from the other direction: it uses `H1 = 1`, `H2 = 2`, `H3 = 3`, `H4 = 4` — literal single values, zero range width — with `RandomTrailers = on`, and reportedly works fine. A range costs nothing on the wire (an observer only ever sees the same random ciphertext bytes regardless of how wide the *receiver's* acceptance window is), so a single value is strictly safer than any range, with no obfuscation trade-off. ## Live-tested fix Narrowing only H1-H4 on an already-broken inbound (`RandomTrailers`, `ContentPaddingAddition`, everything else held constant) took upload from 2-3 Mbit/s to 200+ Mbit/s on my test VPS, single-variable, no other change. Confirmed a second time on a real production box: same treatment took it from a flat ~20 Mbit/s to 120-156 Mbit/s across several runs, in line with the other direction on the same box. Separately, I found and fixed an undersized shared outbound packet queue (`internal/amneziawgnet`, the gVisor `channel.Endpoint` between the netstack and the WireGuard device) that silently drops packets under several concurrent TCP connections' simultaneous slow-start growth — confirmed via a debug endpoint exposing gVisor's own `stack.Stats()` counters live during a real multi-connection transfer. This is a separate contributor to "AmneziaWG is slower than VLESS/native" specifically on the download side, independent of `RandomTrailers`. Both fixes are shipped on my fork ([kuzzrus/3x-ui-awg](https://github.com/kuzzrus/3x-ui-awg), `v3.7.0-awg.7`): - H1-H4 generator now emits one single value per field instead of a range (both the Go backend's `GenerateObfuscation20` *and* the frontend's independent `regenInboundAwgObfuscation` copy — **both needed the fix separately**, since the frontend port had silently dropped the width cap the Go version originally had, and is the code path the panel's actual "Regenerate" button goes through). - Packet queue depth raised (1024 → 8192) to absorb multi-connection bursts without dropping. Since #6105 merged this fork's AmneziaWG implementation upstream, both of these likely affect `main` here too — happy to open a PR with both fixes (H1-H4 single-value generation in both places, queue depth) if that's useful.
Author
Owner

@shoei1944 commented on GitHub (Aug 25, 2026):

Good job!

<!-- gh-comment-id:5417539401 --> @shoei1944 commented on GitHub (Aug 25, 2026): Good job!
Author
Owner

@alijazizaib commented on GitHub (Aug 26, 2026):

Commenting to share that I experienced the same issue and fixed it by following @kuzzrus settings. Will wait for main line to update . Certainly suggest to issue PR.

<!-- gh-comment-id:5427522465 --> @alijazizaib commented on GitHub (Aug 26, 2026): Commenting to share that I experienced the same issue and fixed it by following @kuzzrus settings. Will wait for main line to update . Certainly suggest to issue PR.
Author
Owner

@MarketTwits commented on GitHub (Aug 29, 2026):

I confirm, the fix works. Well done, guys!

<!-- gh-comment-id:5461272463 --> @MarketTwits commented on GitHub (Aug 29, 2026): I confirm, the fix works. Well done, guys!
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#4280
No description provided.