mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5099] [MERGED] feat: add manual and automatic WARP IP rotation #5781
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5781
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5099
Author: @rqzbeh
Created: 6/8/2026
Status: ✅ Merged
Merged: 6/8/2026
Merged by: @MHSanaei
Base:
main← Head:feat/warp-ip-rotation📝 Commits (3)
1ca1823feat: add manual and automatic WARP IP rotation809689bfix: update generated api and frontend schemasee5f5b1fix(warp): validate rotation interval, fix auto-update timing, sync editor📊 Changes
27 files changed (+436 additions, -28 deletions)
View changed files
📝
frontend/public/openapi.json(+12 -0)📝
frontend/src/generated/examples.ts(+2 -0)📝
frontend/src/generated/schemas.ts(+12 -0)📝
frontend/src/generated/types.ts(+2 -0)📝
frontend/src/generated/zod.ts(+2 -0)📝
frontend/src/pages/xray/overrides/WarpModal.tsx(+89 -21)➕
util/wireguard.go(+24 -0)📝
web/controller/xray_setting.go(+26 -7)📝
web/entity/entity.go(+3 -0)➕
web/job/warp_ip_job.go(+52 -0)📝
web/service/setting.go(+17 -0)📝
web/service/warp.go(+40 -0)📝
web/service/xray_setting.go(+89 -0)📝
web/translation/ar-EG.json(+5 -0)📝
web/translation/en-US.json(+5 -0)📝
web/translation/es-ES.json(+5 -0)📝
web/translation/fa-IR.json(+5 -0)📝
web/translation/id-ID.json(+5 -0)📝
web/translation/ja-JP.json(+5 -0)📝
web/translation/pt-BR.json(+5 -0)...and 7 more files
📄 Description
Problem Description
Sites like Google, Spotify, and Apple often block or restrict traffic originating from DataCenter IPs, which is why users rely on Cloudflare WARP as an outbound to bypass these restrictions. However, because the WARP IP address does not change automatically, the assigned IP can become "dirty" over time, leading to Google Captcha challenges and other connectivity issues.
Currently, there is no easy way for users to manually request a new WARP IP or automate this process in the 3x-ui panel without rebuilding the entire outbound configuration.
Solution Implemented
This PR introduces a complete workflow to manually and automatically rotate the WARP outbound IP address:
Manual IP Rotation:
WarpModal.tsx)./panel/api/xray/warp/changeIpthat generates a new WireGuard keypair and re-registers the WARP account with Cloudflare to acquire a fresh IP address.Automated IP Rotation:
0disables the feature.WarpUpdateIntervalandWarpLastUpdateto the application'sSettingServiceto store the interval and track the last update timestamp.WarpIpJob) that runs hourly. It checks if the configured number of days has elapsed since the last update and triggers the IP rotation automatically if needed.Files Modified
web/entity/entity.go: AddedWarpUpdateInterval.web/service/setting.go: Added default value, getters, and setters forwarpUpdateIntervalandwarpLastUpdate.web/service/warp.go: ImplementedChangeWarpIP()logic and integrated it with Xray settings updates.web/service/xray_setting.go: ImplementedUpdateWarpXraySettingto apply new WARP credentials deeply into the existing Xray config template.web/controller/xray_setting.go: Registered the/changeIpand/intervalAPI routes.util/wireguard.go: Created helper functionGenerateWireguardKeypairto generate new Curve25519 keys for the WireGuard interface.web/job/warp_ip_job.go: Implemented the scheduled cron job for automated rotation.web/web.go: RegisteredWarpIpJobto run hourly.frontend/src/pages/xray/overrides/WarpModal.tsx: Built the UI components for manual and automatic rotation, communicating with the newly created APIs.Testing Performed
npm run typecheck), linting (eslint), and bundling (npm run build) in the frontend.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.