Skip to content

feat: add AmneziaWG outbound#1

Closed
hawkff wants to merge 1306 commits into
deffrom
feature/amneziawg
Closed

feat: add AmneziaWG outbound#1
hawkff wants to merge 1306 commits into
deffrom
feature/amneziawg

Conversation

@hawkff

@hawkff hawkff commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an amneziawg outbound: an obfuscated WireGuard variant (AmneziaWG) that evades DPI via junk packets (Jc/Jmin/Jmax), randomized packet-size prefixes (S1-S4), magic-header obfuscation (H1-H4), and optional CPS signature packets (I1-I5). With all params zero it behaves like plain WireGuard.

Approach

Consumes amnezia-vpn/amneziawg-go as a pristine upstream dependency (no fork) and adapts our sing-box transport instead — the divergence from sagernet/wireguard-go is tiny (one NewDevice signature + a couple of conn.Bind extras), keeping amneziawg-go independently updatable.

Changes

  • constant.TypeAmneziaWG = "amneziawg"
  • option.AmneziaWGOutboundOptions: WireGuard fields + AWG obfuscation knobs
  • transport/amneziawg/: copy of transport/wireguard with device/conn/tun imports repointed at amneziawg-go (3-arg NewDevice); device-stack files kept byte-identical to the wireguard sibling for maintainability. System-interface mixed-stack mode is unsupported (amneziawg-go lacks Device.InputPacket); the outbound runs gVisor netstack mode.
  • protocol/amneziawg/: the outbound, registering under C.TypeAmneziaWG.

Test plan

  • go build + go vet clean with libcore build tags.
  • Verified end-to-end on Android (NekoBox) from a censored test network: handshake completes, egress IP is the AmneziaWG server, DNS routes cleanly over the tunnel.

Paired with NekoBox app PR hawkff/NekoBoxForAndroid#25.

libtry486 and others added 30 commits July 8, 2025 13:12
fix typo

Signed-off-by: libtry486 <89328481+libtry486@users.noreply.github.com>
Co-authored-by: anytls <anytls>
Signed-off-by: Estel <callmebedrockdigger@gmail.com>
Co-authored-by: anytls <anytls>
Co-authored-by: anytls <anytls>
starifly and others added 26 commits December 20, 2025 14:56
Add an amneziawg outbound that reuses sing-box's WireGuard transport stack but
drives the amnezia-vpn/amneziawg-go engine, so the obfuscation parameters
(Jc/Jmin/Jmax, S1-S4, H1-H4, I1-I5) can be configured. Plain WireGuard is left
untouched.

- transport/amneziawg: copy of transport/wireguard with the device/conn/tun
  imports pointed at amneziawg-go (3-arg NewDevice, no listener/reserved-bind
  extensions), plus device-level AmneziaWG IPC params appended to the UAPI
  config. The device-stack files are kept byte-identical to the wireguard
  sibling for maintainability.
- protocol/amneziawg: outbound registering option.AmneziaWGOutboundOptions
  under C.TypeAmneziaWG.
- option.AmneziaWGOutboundOptions: WireGuard fields + AWG obfuscation knobs.
- constant: TypeAmneziaWG.

amnezia-vpn/amneziawg-go is consumed as a pristine upstream dependency (no
fork), so it can be updated independently.
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Too many files changed for review. (1061 files found, 100 file limit)

@hawkff

hawkff commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@hawkff

hawkff commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

Wrong base branch (def is divergent, showed 1306 commits). Reopening against 1.12.x — the actual base this work branches from.

@hawkff hawkff closed this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.