Skip to content

feat(core): add WireGuard core management support#350

Open
x0sina wants to merge 28 commits intodevfrom
wgcore
Open

feat(core): add WireGuard core management support#350
x0sina wants to merge 28 commits intodevfrom
wgcore

Conversation

@x0sina
Copy link
Copy Markdown
Collaborator

@x0sina x0sina commented Apr 2, 2026

Summary
This PR adds full panel-side support for managing WireGuard cores while preserving the existing Xray flow. The implementation is additive: Xray logic remains intact, WireGuard is introduced through backend_type, and the existing group-to-inbound assignment model is reused instead of forking a separate WireGuard path.

What Changed

  • Added backend_type support for core configs, including persistence and migration with existing records defaulting to xray.
  • Added panel-side WireGuard core parsing/validation via a new WireGuard core config implementation.
  • Generalized CoreManager and node startup so nodes start with the correct backend type and only send Xray-only fields when relevant.
  • Extended user proxy settings with a wireguard section containing private_key, public_key, and peer_ips.
  • Updated node serialization so synced users include wireguard_public_key and wireguard_peer_ips.
  • Added backend validation enforcing the current node/bridge limitation of at most one WireGuard interface per user.
  • Added automatic WireGuard keypair preparation and peer IP allocation for users assigned to exactly one WireGuard interface.
  • Updated dashboard core/user forms to support WireGuard with minimal UI changes and no Xray regression.
  • Generalized node/core version presentation with additive core_version handling while keeping xray_version compatible.

Behavior Guarantees

  • Existing Xray create/update/delete/validate/sync/group flows remain unchanged.
  • Existing Xray fallback and excluded inbound behavior remains backend-scoped and intact.
  • Groups still assign users through inbound_tags; WireGuard now exposes interface_name through that same path.
  • Mixed assignment is allowed for Xray + one WireGuard interface.
  • Multiple WireGuard interfaces for one user are rejected clearly at the panel layer.

Remaining Limitations

  • The panel still enforces one WireGuard interface per user because the current node/bridge contract supports only one WireGuard proxy object per user.
  • Node DB/API compatibility still relies on the existing xray_version field; core_version was added logically at the panel/model layer, not as a full DB rename.
  • WireGuard node core version updates use manual version entry in the dashboard; only Xray-backed nodes use the Xray release picker.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a7d527b-b0aa-47a5-935f-bfcd6d0d844d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wgcore

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants