Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sub
AgeCommit message (Collapse)Author
2026-04-27Minor changesMHSanaei
2026-04-27TCP MasksMHSanaei
2026-04-27sub: kcp finalmaskMHSanaei
2026-04-22sub: dont panic on bad externalProxy entry in genHysteriaLinkpwnnex
The externalProxy fanout from #4073 did `int(ep["port"].(float64))` with no ok-check. If any entry is missing port or has the wrong type it panics, and since this runs in the /sub/<id> handler the whole subscription returns 500. Skip malformed entries instead.
2026-04-22hysteria: also accept "hysteria2" protocol stringpwnnex
UI stores v1 and v2 both as "hysteria" with settings.version, but inbounds that came in from imports / manual SQL can carry the literal "hysteria2" string and get silently dropped everywhere we switch on protocol. Add Hysteria2 constant + IsHysteria helper, use it in the places that gate on protocol (sub SQL, getLink, genHysteriaLink, clash buildProxy, json gen, inbound.go validation, xray AddUser). Existing "hysteria" inbounds are untouched. closes #4081
2026-04-22Fix Hysteria External Proxy + include Hysteria in Clash subscription (#4053) ↵pwnnex
(#4073) * Fix Hysteria External Proxy + include Hysteria in Clash subscription (#4053) Two related gaps on the Hysteria side of the subscription layer: 1) `genHysteriaLink` ignored `externalProxy` entirely, so an admin who pointed a Hysteria inbound at an alternate endpoint (e.g. a CDN hostname forwarding UDP back to the node) still got a link with the original server address. Mirror what `genVlessLink` / `genTrojanLink` already do: fan out one link per entry, substituting `dest` / `port` and picking up the entry's remark suffix. As a bonus, the salamander obfs password is now copied into the URL too — the panel-side link generator already did this, so the subscription output was lagging behind it. 2) `buildProxy` in `subClashService.go` had a protocol switch with cases for VMESS / VLESS / Trojan / Shadowsocks and a `default: return nil`. Hysteria inbounds fell into the default branch and silently vanished from the Clash YAML. Route Hysteria to a dedicated `buildHysteriaProxy` helper before the transport/security helpers run (applyTransport / applySecurity model xray streams, which Hysteria doesn't use). `buildHysteriaProxy` reads `inbound.StreamSettings` directly instead of going through `streamData` / `tlsData`, because those prune fields (`allowInsecure`, the salamander `finalmask.udp` block) that the mihomo Hysteria proxy wants preserved. Output shape matches mihomo's expectations: type: hysteria2 # or "hysteria" for v1 password / auth-str: <client auth> sni, alpn, skip-cert-verify, client-fingerprint obfs: salamander obfs-password: <finalmask.udp[salamander].settings.password> The existing `getProxies` fanout over `externalProxy` already plugs in for Clash, so with Hysteria now recognised, External Proxy entries also flow through to the Clash output for Hysteria inbounds. Closes #4053 * gofmt: align map keys in buildHysteriaProxy --------- Co-authored-by: pwnnex <eternxles@gmail.com>
2026-04-21sub json fix fragment noises effectMHSanaei
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
2026-04-21Fix xhttp xPadding settings missing from generated links (panel + subs) (#4065)pwnnex
* Fix: propagate xhttp xPadding settings into generated subscription links The four `genXLink` helpers in `sub/subService.go` only copied `path`, `host` and `mode` out of `xhttpSettings` when building vmess:// / vless:// / trojan:// / ss:// URLs. Everything else — `xPaddingBytes`, `xPaddingObfsMode`, `xPaddingKey`, `xPaddingHeader`, `xPaddingPlacement`, `xPaddingMethod` — was silently dropped. That meant an admin who set, say, `xPaddingBytes: "80-600"` plus obfs mode with a custom `xPaddingKey` on the inbound had a server config that no client could match from the copy-pasted link: the client kept the xray/sing-box internal defaults (`100-1000`, `x_padding`, `Referer`), hit the server, and was rejected by invalid padding (queryInHeader=Referer, key=x_padding) length: 0 The user-visible symptom on OpenWRT / Podkop / sing-box was "xhttp inbound just won't connect" — no obvious pointer to what was actually wrong because the link itself *looks* complete. Fix: * New helper `applyXhttpPaddingParams(xhttp, params)` writes `x_padding_bytes=<range>` (flat, sing-box family reads this) and an `extra=<url-encoded-json>` blob carrying the full set of xhttp settings (xray-core family reads this). Both encodings are emitted side-by-side so every mainstream client can pick at least one up. * All four link generators (`genVmessLink` via the obj map, `genVlessLink`, `genTrojanLink`, `genShadowsocksLink`) now invoke the copy. * Obfs-only fields (`xPaddingKey`, `xPaddingHeader`, `xPaddingPlacement`, `xPaddingMethod`) are only included when `xPaddingObfsMode` is actually true and the admin filled them in. An inbound with no custom padding produces exactly the same URL as before — existing subscriptions are unaffected. * Also propagate xhttp xPadding settings into the panel's own Info/QR links The previous commit covered the subscription service (sub/subService.go). The admin-panel side — the "Copy URL" / QR / Info buttons inside inbound details — has four more xhttp-emitting link generators in `web/assets/js/model/inbound.js` (`genVmessLink`, `genVLESSLink`, `genTrojanLink`, `genSSLink`) that had the exact same gap: only `path`, `host` and `mode` were copied. Mirror the server-side fix on the client: * Add two static helpers on `Inbound`: - `Inbound.applyXhttpPaddingToParams(xhttp, params)` for `vless://` / `trojan://` / `ss://` style URLs — writes `x_padding_bytes=<range>` (sing-box family) and `extra=<url-encoded-json>` (xray-core family). - `Inbound.applyXhttpPaddingToObj(xhttp, obj)` for the VMess base64 JSON body — sets the same fields directly on the object. * Call them from all four link generators so an admin who enables obfs mode + a custom `xPaddingKey` / `xPaddingHeader` actually gets a working URL from the panel. * Only non-empty fields are emitted, so default inbounds produce exactly the same URL as before. Also fixes a latent positional-args bug in `web/assets/js/model/outbound.js`: both VMess-JSON (L933) and `fromParamLink` (L975) were calling `new xHTTPStreamSettings(path, host, mode)` — but the 3rd positional arg of the constructor is `headers`, not `mode`, so `mode` was landing in the `headers` slot and the actual `mode` field stayed at its default. Construct explicitly and set `mode` by name; while here, also pick up `x_padding_bytes` and the `extra` JSON blob from the imported URL so the symmetric case of importing a padded link works too. --------- Co-authored-by: pwnnex <eternxles@gmail.com>
2026-04-20add hysteria inboundMHSanaei
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
2026-04-20Use vnext/users structure for VLESS outboundMHSanaei
Replace the previous flat settings map for VLESS outbound with a vnext/users structure. Encryption is now pulled from inbound settings into the user object, a level field (8) is added, and client id and flow are preserved. Address and port are nested under vnext and outbound.Settings is set to {vnext: [...]}, aligning the outbound format with the expected VLESS schema. Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
2026-04-20Add SSRF protection (#4044)Sanaei
* Add SSRF protection for custom geo downloads Introduce SSRF-safe HTTP transport for custom geo operations by adding ssrfSafeTransport and isBlockedIP helpers. The transport resolves hosts and blocks loopback, private, link-local and unspecified addresses, returning ErrCustomGeoSSRFBlocked on violations. Update probeCustomGeoURLWithGET, probeCustomGeoURL and downloadToPathOnce to use the safe transport. Also add the new error ErrCustomGeoSSRFBlocked and necessary imports. Minor whitespace/formatting adjustments in subClashService.go, web/entity/entity.go and web/service/setting.go. * Add path traversal protection for custom geo Prevent path traversal when handling custom geo downloads by adding ErrCustomGeoPathTraversal and a validateDestPath() helper that ensures destination paths stay inside the bin folder. Call validateDestPath from downloadToPathOnce, Update and Delete paths and wrap errors appropriately. Reconstruct sanitized URLs in sanitizeURL to break taint propagation before use. Map the new path-traversal error to a user-facing i18n message in the controller. * fix
2026-04-19feat add clash yaml convert (#3916)zhuzn
* docs(agents): add AI agent guidance documentation * feat(sub): add Clash/Mihomo YAML subscription service Add SubClashService to convert subscription links to Clash/Mihomo YAML format for direct client compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(sub): integrate Clash YAML endpoint into subscription system - Add Clash route handler in SUBController - Update BuildURLs to include Clash URL - Pass Clash settings through subscription pipeline Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(web): add Clash settings to entity and service - Add SubClashEnable, SubClashPath, SubClashURI fields - Add getter methods for Clash configuration - Set default Clash path to /clash/ and enable by default Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ui): add Clash settings to subscription panels - Add Clash enable switch in general subscription settings - Add Clash path/URI configuration in formats panel - Display Clash QR code on subscription page - Rename JSON tab to "Formats" for clarity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(js): add Clash support to frontend models - Add subClashEnable, subClashPath, subClashURI to AllSetting - Generate and display Clash QR code on subscription page - Handle Clash URL in subscription data binding Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
2026-04-19fix(sub): use safe type assertion for xhttp mode field (#3990)Nikita Nemirovsky
Unsafe type assertion `xhttp["mode"].(string)` panics when mode is nil (e.g., when xhttpSettings only contains path without mode). The panic is caught by Gin's recovery middleware and returned as HTTP 500. Use comma-ok pattern matching the fix already applied to gRPC's authority field in 21d98813. Fixes #3987
2026-02-15Improve telego client robustness and retriesMHSanaei
Add a createRobustFastHTTPClient helper to configure fasthttp.Client with better timeouts, connection limits, retries and optional SOCKS5 proxy dialing. Validate and sanitize proxy and API server URLs instead of returning early on invalid values, and build telego.Bot options dynamically. Reduce long-polling timeout to detect connection issues faster and adjust update retrieval comments. Implement exponential-backoff retry logic for SendMessage calls to handle transient connection/timeouts and improve delivery reliability; also reduce inter-message delay for better throughput.
2026-02-11Remove allowInsecureMHSanaei
Remove the deprecated `allowInsecure`
2026-02-09refactor: set default ProfileUrl (#3773)Nebulosa
2026-02-08refactor: set header only if it not empty (#3763)Nebulosa
2026-02-03Add workflow to clean old GitHub Actions cachesMHSanaei
Adds a scheduled GitHub Actions workflow (.github/workflows/cleanup_caches.yml) that runs weekly (and via workflow_dispatch) to delete Actions caches not accessed in the last 3 days. The job uses the gh CLI with the repository token and actions: write permission to list caches, filter by last_accessed_at against a 3-day cutoff, and delete matching cache IDs.
2026-01-27feat: more subscription information fields (#3701)Danil S.
* feat: more subscription information fields * fix: incorrect translation * feat: implement field for Happ custom routing rules
2026-01-05Refactor code and fix linter warnings (#3627)Ilya Kryuchkov
* refactor: use any instead of empty interface * refactor: code cleanup
2026-01-03vless: use Inbound Listen address in Subscription service (#3610)Igor Kamyshnikov
* vless: use Inbound Listen address in Subscription service vless manual connection link and subscription produced connection link are aligned. subscription service now returns an IP address configured on Inbound, instead of subscription service IP, which is consistent when the address, returned by QR code for manual vless link distribution.
2025-10-09feat: add file logger support (#3575)Slava M.
* feat: add backend for file logger
2025-09-24tiny changesmhsanaei
2025-09-21improved sub: BuildURLsmhsanaei
2025-09-20undo vnext for vmessmhsanaei
2025-09-20docs: add comments for all functionsmhsanaei
2025-09-19go package correction v2mhsanaei
2025-09-19go package correctionmhsanaei
2025-09-18new: subJsonEnablemhsanaei
after this subEnable by default is true and subJsonEnable is false
2025-09-18minor changemhsanaei
2025-09-16sub page: improvedmhsanaei
2025-09-16vnext removedmhsanaei
2025-09-15sub template enhancementsAlireza Ahmadi
2025-09-14v2.8.0v2.8.0mhsanaei
2025-09-14enhancementsAlireza Ahmadi
2025-09-14Subscriptionmhsanaei
2025-09-09dokodemo-door, socks renamed to mixed, tunnelmhsanaei
2025-09-07Vlessenc (#3426)Sanaei
* mlkem768 * VlessEnc
2025-08-17minor changesmhsanaei
2025-08-04fix: pqv for sub #3306mhsanaei
2025-07-25add mldsa65Alireza Ahmadi
2025-04-15fix: encoding subscription title in base64Shishkevich D.
2025-03-15feat: custom subscription title in panel (#2773)Ilya Afanasov
* feat: custom subscription title in panel * feat: added translations
2025-03-12Refactor: Use any instead of interface{}mhsanaei
2025-01-01tcpNoDelay to penetratemhsanaei
2024-12-04Transport: Remove HTTPmhsanaei
Migrated to XHTTP "stream-one" mode.
2024-12-04splithttp to xhttpmhsanaei
2024-11-21AsIs - freedom DSmhsanaei
2024-11-14SplitHTTP - Modemhsanaei
2024-10-29removed - XTLS Securitymhsanaei
because its too old and no one use it anymore