mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5256] [Feature]: SOCKS proxy for specific nodes #3684
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#3684
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?
Originally created by @mshahr1 on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5256
Is your feature request related to a problem?
Adding an option to enable a SOCKS proxy for specific nodes: The reason for this suggestion is that, due to the current network conditions in Iran, nodes located outside the country are not easily accessible. Having an option to route API requests through a proxy would be a massive help.
Thank you again for all your hard work!
Describe the solution you'd like
On node tabs, enabling socks5 proxy for specific node
Alternatives you've considered
No response
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
No response
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 13, 2026):
This feature does not currently exist. Confirmed by reading the source: the
Nodestruct (internal/database/model/model.go, lines 450–509) has no proxy field, andinternal/web/runtime/remote.go(line 26) uses a single sharedremoteHTTPClientfor all node API calls with no per-node proxy support.The good news for a PR author is that most of the infrastructure already exists.
What is already in the codebase
internal/util/netproxy/netproxy.go— a reusableNewHTTPClient(proxyURL string, timeout time.Duration)that builds a standard*http.Clientwith a SOCKS5 (or HTTP/HTTPS) dialer, backed bygolang.org/x/net/proxy. Accepted formats:socks5://host:port,socks5://user:pass@host:port,http://...,https://.... An empty string means direct connection.internal/web/service/node.go— thenodeHTTPClientFor(n *model.Node)function (around line 61) already demonstrates creating a node-specific*http.Clientbased on per-row settings (TlsVerifyMode,PinnedCertSha256). The proxy extension follows exactly the same pattern.internal/web/service/setting.go(GetTgBotProxy()) andinternal/web/service/tgbot/tgbot.go— show a working panel-wide egress proxy applied to an outbound HTTP client. Per-node proxy is the same concept scoped to the row.Minimal set of changes a PR would need
Database model (
internal/database/model/model.go,Nodestruct): add one field, e.g.GORM auto-migration will add the column automatically.
Node service (
internal/web/service/node.go,normalize()andUpdate()): validate the URL format (accept empty string as "no proxy"); add"proxy_url"to theupdatesmap inUpdate().Remote runtime (
internal/web/runtime/remote.go): instead of always using the package-levelremoteHTTPClient, have theRemotestruct hold its own*http.Clientbuilt inNewRemote()vianetproxy.NewHTTPClient(n.ProxyUrl, remoteHTTPTimeout). Fall back to the shared client whenProxyUrlis empty if you want to preserve connection pooling for the common case.Frontend schema (
frontend/src/schemas/node.ts): addproxyUrl: z.string().optional().Frontend form (
frontend/src/pages/nodes/NodeFormModal.tsx): add aForm.Itemfor the proxy URL with a placeholder such assocks5://127.0.0.1:1080orsocks5://user:pass@host:port.Relationship to #4718
Issue #4718 is about the Telegram bot's SOCKS5 proxy (a panel-wide setting, different subsystem). This request is independent — it concerns per-node API connectivity, not the Telegram bot.
To proceed, open a PR against
mainwith the changes above. Please include theProxyUrlfield validation and a note in the PR description about which proxy schemes are accepted.This reply was generated automatically; a maintainer may follow up.