[GH-ISSUE #6350] [Question]: Is Wireguard in kernel mode or userspce mode in 3x-ui 3.7.0 ? #4311

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

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

What are you trying to do?

Is Wireguard in kernel mode or userspace mode in 3x-ui 3.7.0 ?

What have you already tried?

No response

3x-ui version

3.7.0

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24.04

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @hussain0011 on GitHub (Aug 28, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6350 ### What are you trying to do? Is Wireguard in kernel mode or userspace mode in 3x-ui 3.7.0 ? ### What have you already tried? _No response_ ### 3x-ui version 3.7.0 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24.04 ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
bsakaguchi 2026-10-31 20:38:44 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

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

Userspace, in both cases. 3x-ui 3.7.0 has no kernel-mode WireGuard path at all — no kernel module, no DKMS build, and no wg/wg-quick involvement on the host.

There are two separate WireGuard-family features in the panel, and they take two different userspace routes:

1. AmneziaWG inbounds (protocol amneziawg) — embedded in the panel process

internal/amneziawgnet/netstack.go:1:

// Package amneziawgnet embeds amneziawg-go (a userspace AmneziaWG
// implementation, https://github.com/amnezia-vpn/amneziawg-go) directly in
// the panel process, as an alternative to internal/amneziawg's
// kernel-module (DKMS) + awg-quick approach. A gVisor userspace network
// stack (gvisor.dev/gvisor/pkg/tcpip -- already an indirect dependency via
// xray-core's own proxy/wireguard support) terminates each tunnel

These inbounds are deliberately kept out of the generated Xray config — internal/web/service/xray.go:177:

if inbound.Protocol == model.MTProto || inbound.Protocol == model.AmneziaWG {
    continue
}

and are reconciled instead by the amneziawg_job cron every 10s (docs/architecture.md:376). Each peer's decapsulated traffic then relays into its own loopback SOCKS5 Xray inbound (injectAmneziawgnetSocks, called at internal/web/service/xray.go:383), which is how per-client stats, sniffing and routing still work.

This fork did originally ship a kernel-module implementation, and it was removed. internal/amneziawg/instance.go:4:

// 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) in a hard cutover.

2. Plain WireGuard inbounds/outbounds (protocol wireguard) — inside the Xray-core child process

The panel treats these as ordinary Xray objects: peers are rewritten into the shape xray-core's wireguard inbound expects at internal/database/model/model.go:364 (case WireGuard: → WireguardClientsToPeers), and users are added over Xray's gRPC handler API (internal/xray/api.go:623, case "wireguard":). Xray-core's own proxy/wireguard is likewise userspace — internal/amneziawgnet/netstack.go:38 describes its stack as "the same approach amneziawg-go's own tun/netstack package and xray-core's proxy/wireguard/netstack.go both take", and golang.zx2c4.com/wireguard (wireguard-go) is present in go.mod:110 as an indirect dependency pulled in by xray-core. The same applies to the WARP / Nord / PIA WireGuard outbounds.

What this means in practice

  • Nothing shows up in wg show or ip link on the host — the tunnel never becomes a kernel network interface.
  • No wireguard-tools, no DKMS, no Secure Boot signing problem, and it behaves the same inside a container as on bare metal. (The NET_ADMIN/NET_RAW capabilities in docker-compose.yml are for fail2ban's iptables IP-limit enforcement, not for WireGuard.)
  • The trade-off is the usual one: userspace crypto and packet handling cost more CPU than the kernel module at high throughput.

The AmneziaWG page states this too: https://docs.sanaei.dev/en/docs/config/amneziawg

One note on versions: v3.7.0 is the current latest release (2026-08-24) and the default branch sits at that tag, so everything above is read from exactly the code you are running.

Verdict: Not a bug (expected behaviour)

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

<!-- gh-comment-id:5454789684 --> @github-actions[bot] commented on GitHub (Aug 28, 2026): **Userspace, in both cases.** 3x-ui 3.7.0 has no kernel-mode WireGuard path at all — no kernel module, no DKMS build, and no `wg`/`wg-quick` involvement on the host. There are two separate WireGuard-family features in the panel, and they take two different userspace routes: **1. AmneziaWG inbounds (protocol `amneziawg`) — embedded in the panel process** `internal/amneziawgnet/netstack.go:1`: ```go // Package amneziawgnet embeds amneziawg-go (a userspace AmneziaWG // implementation, https://github.com/amnezia-vpn/amneziawg-go) directly in // the panel process, as an alternative to internal/amneziawg's // kernel-module (DKMS) + awg-quick approach. A gVisor userspace network // stack (gvisor.dev/gvisor/pkg/tcpip -- already an indirect dependency via // xray-core's own proxy/wireguard support) terminates each tunnel ``` These inbounds are deliberately kept out of the generated Xray config — `internal/web/service/xray.go:177`: ```go if inbound.Protocol == model.MTProto || inbound.Protocol == model.AmneziaWG { continue } ``` and are reconciled instead by the `amneziawg_job` cron every 10s (`docs/architecture.md:376`). Each peer's decapsulated traffic then relays into its own loopback SOCKS5 Xray inbound (`injectAmneziawgnetSocks`, called at `internal/web/service/xray.go:383`), which is how per-client stats, sniffing and routing still work. This fork *did* originally ship a kernel-module implementation, and it was removed. `internal/amneziawg/instance.go:4`: ```go // 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) in a hard cutover. ``` **2. Plain WireGuard inbounds/outbounds (protocol `wireguard`) — inside the Xray-core child process** The panel treats these as ordinary Xray objects: peers are rewritten into the shape xray-core's wireguard inbound expects at `internal/database/model/model.go:364` (`case WireGuard:` → `WireguardClientsToPeers`), and users are added over Xray's gRPC handler API (`internal/xray/api.go:623`, `case "wireguard":`). Xray-core's own `proxy/wireguard` is likewise userspace — `internal/amneziawgnet/netstack.go:38` describes its stack as "the same approach amneziawg-go's own tun/netstack package and xray-core's proxy/wireguard/netstack.go both take", and `golang.zx2c4.com/wireguard` (wireguard-go) is present in `go.mod:110` as an indirect dependency pulled in by xray-core. The same applies to the WARP / Nord / PIA WireGuard **outbounds**. **What this means in practice** - Nothing shows up in `wg show` or `ip link` on the host — the tunnel never becomes a kernel network interface. - No `wireguard-tools`, no DKMS, no Secure Boot signing problem, and it behaves the same inside a container as on bare metal. (The `NET_ADMIN`/`NET_RAW` capabilities in `docker-compose.yml` are for fail2ban's iptables IP-limit enforcement, not for WireGuard.) - The trade-off is the usual one: userspace crypto and packet handling cost more CPU than the kernel module at high throughput. The AmneziaWG page states this too: <https://docs.sanaei.dev/en/docs/config/amneziawg> One note on versions: v3.7.0 is the current latest release (2026-08-24) and the default branch sits at that tag, so everything above is read from exactly the code you are running. Verdict: Not a bug (expected behaviour) *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#4311
No description provided.