[GH-ISSUE #6302] [Feature]: Add AmneziaWG support to outbounds #4278

Closed
opened 2026-10-31 20:38:29 +07:00 by bsakaguchi · 1 comment
Owner

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

For hardened cascading tunnels from panel to panel...

Describe the solution you'd like

Actually, the subject. Add this option in the outbound settings.

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Other

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @Bushroott on GitHub (Aug 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6302 ### Is your feature request related to a problem? For hardened cascading tunnels from panel to panel... ### Describe the solution you'd like Actually, the subject. Add this option in the outbound settings. ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Other ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:38:29 +07:00
Author
Owner

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

This is a valid gap, and it is a bigger one than it looks: AmneziaWG in 3x-ui is inbound-only today, and it cannot be added to outbounds by hanging the obfuscation fields off the existing WireGuard outbound — inbound AmneziaWG and outbounds run on two different engines.

Why the WireGuard outbound can't just grow the AWG fields

Outbound JSON is handed to Xray-core verbatim — internal/xray/config.go:16:

OutboundConfigs  json_util.RawMessage `json:"outbounds"`

so an outbound can only do what an Xray-core proxy implements. Extra jc / s1 / h1 keys in the WireGuard outbound settings would be inert, not obfuscation. The settings that outbound actually accepts are exactly these, in frontend/src/schemas/forms/outbound-form.ts:102-111:

export const WireguardOutboundFormSettingsSchema = z.object({
  mtu, secretKey, pubKey, address, domainStrategy, reserved, peers, noKernelTun
});

and the outbound protocol list (frontend/src/schemas/primitives/outbound-protocol.ts:1-14) has twelve entries — freedom, blackhole, dns, vmess, vless, trojan, shadowsocks, wireguard, hysteria, socks, http, loopback — with no AmneziaWG among them.

What AmneziaWG is in this panel

It is deliberately not an Xray protocol. It runs embedded in the panel process, github.com/amnezia-vpn/amneziawg-go/v3 (go.mod:6) over a gVisor userspace netstack. From the package doc at internal/amneziawg/instance.go:1-10:

It no longer manages any OS-level interface itself: that was the kernel-module (DKMS) + awg-quick + TPROXY architecture this fork shipped originally, retired in favor of an embedded, pure-Go one (amneziawg-go over a gVisor netstack, see internal/amneziawgnet)

and the only entry point into that subsystem is a server one — internal/amneziawg/instance.go:27, func InstanceFromInbound(ib *model.Inbound) (Instance, bool), which returns false unless ib.Protocol == model.AmneziaWG on a stored inbound row. It is reconciled by internal/web/job/amneziawg_job.go on a 10-second cron (docs/architecture.md:376), and each peer's decapsulated traffic is relayed into a loopback Xray SOCKS5 inbound (internal/amneziawgnet/relay.go, internal/amneziawgnet/socks_config.go).

An AmneziaWG outbound is therefore the mirror image of all of that, and none of it exists yet: an amneziawg-go device in client mode dialing a remote endpoint, an egress path from Xray into that device (the reverse of the current inbound relay), its own reconcile loop, plus the outbound form/schema/adapter work. That is a maintainer-scope architecture decision rather than a small patch, so I'm not going to guess at the shape it should take.

Not a duplicate

Every earlier AmneziaWG request — #2459, #3017, #3330, #4849, #5090, #5113, #5237, #5300, #5818 — asked for inbound/server support. That shipped in effcccce "feat(amneziawg): add native AmneziaWG protocol support (#6105)", first released in v3.7.0. Yours is the outbound counterpart and has not been filed before, so I'm leaving this open on its own.

What you can do today for a hardened panel-to-panel hop

  1. Use a DPI-resistant Xray outbound for the inter-panel leg. VLESS + REALITY is available on outbounds (frontend/src/pages/xray/outbounds/OutboundFormModal.tsx:530), as is Hysteria2. This needs no host-level changes and is the supported path.
  2. Bring the AmneziaWG tunnel up on the host yourself and bind the outbound to it. The outbound form already exposes streamSettings.sockopt.interface as Interface (frontend/src/pages/xray/outbounds/transport/sockopt.tsx:104-109, schema at frontend/src/schemas/protocols/stream/sockopt.ts:72) and sockopt.mark as Mark (fwmark) (same file, lines 98-103) for a policy route. The panel would not manage that tunnel's lifecycle, and I cannot run anything here — treat this as a pointer to the existing fields, not a verified recipe.

Verdict: Feature request

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

<!-- gh-comment-id:5398049484 --> @github-actions[bot] commented on GitHub (Aug 24, 2026): This is a valid gap, and it is a bigger one than it looks: AmneziaWG in 3x-ui is **inbound-only** today, and it cannot be added to outbounds by hanging the obfuscation fields off the existing WireGuard outbound — inbound AmneziaWG and outbounds run on two different engines. ### Why the WireGuard outbound can't just grow the AWG fields Outbound JSON is handed to Xray-core verbatim — `internal/xray/config.go:16`: ```go OutboundConfigs json_util.RawMessage `json:"outbounds"` ``` so an outbound can only do what an Xray-core proxy implements. Extra `jc` / `s1` / `h1` keys in the WireGuard outbound settings would be inert, not obfuscation. The settings that outbound actually accepts are exactly these, in `frontend/src/schemas/forms/outbound-form.ts:102-111`: ```ts export const WireguardOutboundFormSettingsSchema = z.object({ mtu, secretKey, pubKey, address, domainStrategy, reserved, peers, noKernelTun }); ``` and the outbound protocol list (`frontend/src/schemas/primitives/outbound-protocol.ts:1-14`) has twelve entries — `freedom, blackhole, dns, vmess, vless, trojan, shadowsocks, wireguard, hysteria, socks, http, loopback` — with no AmneziaWG among them. ### What AmneziaWG is in this panel It is deliberately **not** an Xray protocol. It runs embedded in the panel process, `github.com/amnezia-vpn/amneziawg-go/v3` (`go.mod:6`) over a gVisor userspace netstack. From the package doc at `internal/amneziawg/instance.go:1-10`: > It no longer manages any OS-level interface itself: that was the kernel-module (DKMS) + awg-quick + TPROXY architecture this fork shipped originally, retired in favor of an embedded, pure-Go one (amneziawg-go over a gVisor netstack, see internal/amneziawgnet) and the only entry point into that subsystem is a **server** one — `internal/amneziawg/instance.go:27`, `func InstanceFromInbound(ib *model.Inbound) (Instance, bool)`, which returns `false` unless `ib.Protocol == model.AmneziaWG` on a stored *inbound* row. It is reconciled by `internal/web/job/amneziawg_job.go` on a 10-second cron (`docs/architecture.md:376`), and each peer's decapsulated traffic is relayed into a loopback Xray SOCKS5 inbound (`internal/amneziawgnet/relay.go`, `internal/amneziawgnet/socks_config.go`). An AmneziaWG **outbound** is therefore the mirror image of all of that, and none of it exists yet: an amneziawg-go device in *client* mode dialing a remote endpoint, an egress path from Xray into that device (the reverse of the current inbound relay), its own reconcile loop, plus the outbound form/schema/adapter work. That is a maintainer-scope architecture decision rather than a small patch, so I'm not going to guess at the shape it should take. ### Not a duplicate Every earlier AmneziaWG request — #2459, #3017, #3330, #4849, #5090, #5113, #5237, #5300, #5818 — asked for inbound/server support. That shipped in `effcccce` *"feat(amneziawg): add native AmneziaWG protocol support (#6105)"*, first released in **v3.7.0**. Yours is the outbound counterpart and has not been filed before, so I'm leaving this open on its own. ### What you can do today for a hardened panel-to-panel hop 1. **Use a DPI-resistant Xray outbound for the inter-panel leg.** VLESS + REALITY is available on outbounds (`frontend/src/pages/xray/outbounds/OutboundFormModal.tsx:530`), as is Hysteria2. This needs no host-level changes and is the supported path. 2. **Bring the AmneziaWG tunnel up on the host yourself and bind the outbound to it.** The outbound form already exposes `streamSettings.sockopt.interface` as **Interface** (`frontend/src/pages/xray/outbounds/transport/sockopt.tsx:104-109`, schema at `frontend/src/schemas/protocols/stream/sockopt.ts:72`) and `sockopt.mark` as **Mark (fwmark)** (same file, lines 98-103) for a policy route. The panel would not manage that tunnel's lifecycle, and I cannot run anything here — treat this as a pointer to the existing fields, not a verified recipe. Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4278
No description provided.