[GH-ISSUE #5407] [Feature]: Clone inbound to any node (not only local panel) #3785

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

Originally created by @jshir700 on GitHub (Jun 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5407

Currently the "Clone" action on the Inbounds page always creates the cloned inbound on the local panel — there is no way to clone an inbound directly to a remote node without manual copy-paste through the "Add inbound" form. Users with many nodes (e.g. 10+ geographically distributed servers) have to:

  1. Clone the inbound locally.
  2. Open the clone for editing.
  3. Switch the "Deploy to" dropdown to the target node.
  4. Adjust the port if there is a conflict.
  5. Save.

This is tedious and error-prone when repeating for many inbounds across many nodes.

Describe the solution you'd like

Frontend: extend the Clone confirmation dialog

Current clone dialog (InboundsPage.tsx → onClone) is a modal.confirm() with a text confirmation. Replace it with a custom modal that includes:

1. Target node selector

A Select dropdown listing all online nodes plus "Local panel" (the default). The default selection should be the current node of the inbound being cloned:

  • If the inbound is on a remote node → pre-select that node.
  • If the inbound is on the local panel → pre-select "Local panel".

This mirrors the "Deploy to" field in the Add/Edit inbound form (InboundFormModal.tsx line 532), reusing the same selectableNodes data that's already available.

2. Port handling (conflict-aware)

The current clone always assigns a random port (RandomUtil.randomInteger(10000, 60000)). Change this to:

  • Check if the source port is free on the target node/panel.
  • If free → keep the original port (user expects a 1:1 clone).
  • If busy → auto-assign a random port and show a warning message: "Port {original} is in use on {target}, assigned random port {new} instead."

The port conflict check is already implemented server-side (checkPortConflict in port_conflict.go), so we can either:

  • Call a lightweight GET endpoint to pre-check before submitting, or
  • Let the backend return the conflict error and retry with a random port.

3. Other fields

Field Behaviour
remark Keep existing: "{original remark} (clone)"
enable Keep existing: false
clients Keep existing: cleared ([])
nodeId New: set to the selected target node, or null for local panel
shareAddrStrategy Keep the original value from the source inbound (already implemented at line 468)
shareAddr Keep the original value from the source inbound (already implemented at line 469)
All security / protocol / stream settings Identical copy of the source inbound

Backend: conflict-based port fallback in AddInbound (optional enhancement)

The backend AddInbound already calls checkPortConflict and returns a 400 error on conflict. The frontend could catch this and retry with a random port. Alternatively, AddInbound could accept a new optional query parameter ?autoResolvePort=true that makes it pick a random port on conflict instead of failing.

Alternatives you've considered

  1. Manual clone → Edit → Change node — works but requires 3 extra clicks per inbound. For a 12-node deployment with 6 inbounds each, that's 216 extra clicks per full deployment.

  2. Export JSON → manually edit nodeId → re-import — works for advanced users but is not user-friendly and requires knowing the nodeId integer values.

  3. Bulk-import via /panel/api/inbounds/import — only imports to local panel, no nodeId support.

Concrete use case

I manage a multi-node 3x-ui deployment with 17 panels (1 local + 16 remote nodes across US, EU, APAC, ME). Each node carries 6 standard inbounds (tcp, xhttp, grpc, noenc, CF-xhttp, hy2) sharing the same port scheme (41881, 41872, 41878, 41879, 23474, 41882).

When provisioning a new node, I need to clone each of the 6 reference inbounds to it. With the current workflow:

  • Per inbound: clone → edit → change node → check port → save → repeat → ~30 seconds × 6 = 3 minutes per node
  • × 16 nodes = ~48 minutes of repetitive clicking

With the proposed feature:

  • Select target node once → clone all 6 inbounds → ports auto-resolve → ~2 minutes per node
  • × 16 nodes = ~5 minutes

Mockups, screenshots, or examples

┌──────────────────────────────────────────────────┐
│  Clone Inbound                                   │
│                                                  │
│  Source: 🇰🇷 Spring3-ARM1-VLESS-tcp (port 41881) │
│                                                  │
│  Target node:  [▼ Local panel                  ] │
│                [  Local panel                   ] │
│                [  Frankfurt1-ARM1 (online)      ] │
│                [  San Jose3-ARM1 (online)       ] │
│                [  Tokyo2-ARM1 (online)          ] │
│                [  ...                           ] │
│                                                  │
│  ℹ Port 41881 is available on target node.       │
│                                                  │
│         [Cancel]    [Clone to node]              │
└──────────────────────────────────────────────────┘

Which parts of the panel would this affect?

Frontend (UI / panel pages), Multi-node (sub-nodes)

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 @jshir700 on GitHub (Jun 17, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5407 ### Is your feature request related to a problem? Currently the "Clone" action on the Inbounds page always creates the cloned inbound on the **local panel** — there is no way to clone an inbound directly to a remote node without manual copy-paste through the "Add inbound" form. Users with many nodes (e.g. 10+ geographically distributed servers) have to: 1. Clone the inbound locally. 2. Open the clone for editing. 3. Switch the "Deploy to" dropdown to the target node. 4. Adjust the port if there is a conflict. 5. Save. This is tedious and error-prone when repeating for many inbounds across many nodes. ### Describe the solution you'd like ### Frontend: extend the Clone confirmation dialog Current clone dialog (`InboundsPage.tsx` → `onClone`) is a `modal.confirm()` with a text confirmation. Replace it with a custom modal that includes: **1. Target node selector** A `Select` dropdown listing all online nodes plus "Local panel" (the default). The default selection should be the **current node** of the inbound being cloned: - If the inbound is on a remote node → pre-select that node. - If the inbound is on the local panel → pre-select "Local panel". This mirrors the "Deploy to" field in the Add/Edit inbound form (`InboundFormModal.tsx` line 532), reusing the same `selectableNodes` data that's already available. **2. Port handling (conflict-aware)** The current clone always assigns a random port (`RandomUtil.randomInteger(10000, 60000)`). Change this to: - Check if the source port is free on the target node/panel. - If free → keep the original port (user expects a 1:1 clone). - If busy → auto-assign a random port and show a warning message: _"Port {original} is in use on {target}, assigned random port {new} instead."_ The port conflict check is already implemented server-side (`checkPortConflict` in `port_conflict.go`), so we can either: - Call a lightweight GET endpoint to pre-check before submitting, or - Let the backend return the conflict error and retry with a random port. **3. Other fields** | Field | Behaviour | |-------|-----------| | `remark` | Keep existing: `"{original remark} (clone)"` | | `enable` | Keep existing: `false` | | `clients` | Keep existing: cleared (`[]`) | | `nodeId` | **New**: set to the selected target node, or `null` for local panel | | `shareAddrStrategy` | Keep the **original value** from the source inbound (already implemented at line 468) | | `shareAddr` | Keep the **original value** from the source inbound (already implemented at line 469) | | All security / protocol / stream settings | Identical copy of the source inbound | ### Backend: conflict-based port fallback in AddInbound (optional enhancement) The backend `AddInbound` already calls `checkPortConflict` and returns a 400 error on conflict. The frontend could catch this and retry with a random port. Alternatively, `AddInbound` could accept a new optional query parameter `?autoResolvePort=true` that makes it pick a random port on conflict instead of failing. ### Alternatives you've considered 1. **Manual clone → Edit → Change node** — works but requires 3 extra clicks per inbound. For a 12-node deployment with 6 inbounds each, that's 216 extra clicks per full deployment. 2. **Export JSON → manually edit nodeId → re-import** — works for advanced users but is not user-friendly and requires knowing the nodeId integer values. 3. **Bulk-import via /panel/api/inbounds/import** — only imports to local panel, no nodeId support. ### Concrete use case I manage a multi-node 3x-ui deployment with **17 panels** (1 local + 16 remote nodes across US, EU, APAC, ME). Each node carries **6 standard inbounds** (tcp, xhttp, grpc, noenc, CF-xhttp, hy2) sharing the same port scheme (41881, 41872, 41878, 41879, 23474, 41882). When provisioning a new node, I need to clone each of the 6 reference inbounds to it. With the current workflow: - Per inbound: clone → edit → change node → check port → save → repeat → ~30 seconds × 6 = 3 minutes per node - × 16 nodes = ~48 minutes of repetitive clicking With the proposed feature: - Select target node once → clone all 6 inbounds → ports auto-resolve → ~2 minutes per node - × 16 nodes = ~5 minutes ### Mockups, screenshots, or examples ``` ┌──────────────────────────────────────────────────┐ │ Clone Inbound │ │ │ │ Source: 🇰🇷 Spring3-ARM1-VLESS-tcp (port 41881) │ │ │ │ Target node: [▼ Local panel ] │ │ [ Local panel ] │ │ [ Frankfurt1-ARM1 (online) ] │ │ [ San Jose3-ARM1 (online) ] │ │ [ Tokyo2-ARM1 (online) ] │ │ [ ... ] │ │ │ │ ℹ Port 41881 is available on target node. │ │ │ │ [Cancel] [Clone to node] │ └──────────────────────────────────────────────────┘ ``` ### Which parts of the panel would this affect? Frontend (UI / panel pages), Multi-node (sub-nodes) ### 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:34:56 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 17, 2026):

This request covers the same feature as #5337 ("Cross-Node Inbound Cloning"), which is already open and accepted on the backlog. Please follow and add any additional context there; the discussion will continue in that thread.

For completeness, the investigation below confirms the current behaviour and validates that the feature is technically feasible as described.

What the code currently does

The clone handler in frontend/src/pages/inbounds/InboundsPage.tsx (lines 433-475) builds the clone payload without a nodeId field, so the inbound always lands on the local panel. The port is always randomised via RandomUtil.randomInteger(10000, 60000) (line 463), ignoring the source port. The Add/Edit form (InboundFormModal.tsx, lines 531-544) already has a working "Deploy to" node selector backed by selectableNodes, but it is only reachable from the full add-inbound flow, not the clone shortcut.

Why the proposed approach is sound

  • AddInbound (backend, internal/web/service/inbound.go) accepts nodeId in the payload and already calls checkPortConflict (internal/web/service/port_conflict.go, line 573) before saving, scoped to the target node, so the same port on a different node is not a conflict.
  • On conflict the backend returns a descriptive error string; the frontend can catch it and fall back to a random port as proposed.
  • The import endpoint (internal/web/controller/inbound.go, lines 377-383) already validates and preserves nodeId when the referenced node exists, confirming the data model supports this end-to-end.
  • The node selector is restricted to the six eligible protocols (VLESS, VMess, Trojan, Shadowsocks, Hysteria2, WireGuard) by the isNodeEligible check in InboundFormModal.tsx (lines 189-194); any clone-to-node implementation should apply the same guard.

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

<!-- gh-comment-id:4727395347 --> @github-actions[bot] commented on GitHub (Jun 17, 2026): This request covers the same feature as #5337 ("Cross-Node Inbound Cloning"), which is already open and accepted on the backlog. Please follow and add any additional context there; the discussion will continue in that thread. For completeness, the investigation below confirms the current behaviour and validates that the feature is technically feasible as described. **What the code currently does** The clone handler in `frontend/src/pages/inbounds/InboundsPage.tsx` (lines 433-475) builds the clone payload without a `nodeId` field, so the inbound always lands on the local panel. The port is always randomised via `RandomUtil.randomInteger(10000, 60000)` (line 463), ignoring the source port. The Add/Edit form (`InboundFormModal.tsx`, lines 531-544) already has a working "Deploy to" node selector backed by `selectableNodes`, but it is only reachable from the full add-inbound flow, not the clone shortcut. **Why the proposed approach is sound** - `AddInbound` (backend, `internal/web/service/inbound.go`) accepts `nodeId` in the payload and already calls `checkPortConflict` (`internal/web/service/port_conflict.go`, line 573) before saving, scoped to the target node, so the same port on a different node is not a conflict. - On conflict the backend returns a descriptive error string; the frontend can catch it and fall back to a random port as proposed. - The import endpoint (`internal/web/controller/inbound.go`, lines 377-383) already validates and preserves `nodeId` when the referenced node exists, confirming the data model supports this end-to-end. - The node selector is restricted to the six eligible protocols (VLESS, VMess, Trojan, Shadowsocks, Hysteria2, WireGuard) by the `isNodeEligible` check in `InboundFormModal.tsx` (lines 189-194); any clone-to-node implementation should apply the same guard. *This reply was generated automatically; a maintainer may follow up.*
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#3785
No description provided.