[PR #6925] [CLOSED] fix(sub): keep host remark intact during CIDR expansion #6527

Closed
opened 2026-11-02 04:09:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6925
Author: @Pejman-Yousefi-Official
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: fix/sub-preserve-cidr-remark


📝 Commits (1)

  • bb438e1 fix(sub): keep host remark intact during CIDR expansion

📊 Changes

4 files changed (+20 additions, -24 deletions)

View changed files

📝 frontend/src/lib/hosts/host-link.ts (+2 -7)
📝 frontend/src/test/tunnel-host-endpoints.test.ts (+2 -2)
📝 internal/sub/host_sub.go (+1 -8)
📝 internal/sub/host_sub_test.go (+15 -7)

📄 Description

Summary

In #6784, CIDR address support was introduced for Host records, allowing a prefix to expand into up to randomCount unique random host IPs. When randomCount > 1, the endpoint builder appended an incremental index suffix ( - 1, - 2, etc.) to the host's remark.

This PR removes the automatic remark suffixing so that the user's configured remark is preserved as-is across all generated endpoints, both in subscription formats and tunnel preview configs.

Changes

  • Backend (internal/sub/host_sub.go): In hostEndpointMaps, removed the index suffix mutation on hCopy.Remark when len(ips) > 1. Removed now-unused fmt import.
  • Frontend (frontend/src/lib/hosts/host-link.ts): In hostEndpointsFor, preserved record.remark directly when expanding CIDR hosts for tunnel configs and client links.
  • Tests:
    • Updated TestSub_HostCIDR_RawLinks and TestSub_HostCIDR_ClashAndJson in internal/sub/host_sub_test.go to assert that remarks remain unsuffixed.
    • Updated frontend/src/test/tunnel-host-endpoints.test.ts to verify the expected remark value.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6925 **Author:** [@Pejman-Yousefi-Official](https://github.com/Pejman-Yousefi-Official) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/sub-preserve-cidr-remark` --- ### 📝 Commits (1) - [`bb438e1`](https://github.com/MHSanaei/3x-ui/commit/bb438e15bcc41f0cf7d184731f945750d8c9b078) fix(sub): keep host remark intact during CIDR expansion ### 📊 Changes **4 files changed** (+20 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/hosts/host-link.ts` (+2 -7) 📝 `frontend/src/test/tunnel-host-endpoints.test.ts` (+2 -2) 📝 `internal/sub/host_sub.go` (+1 -8) 📝 `internal/sub/host_sub_test.go` (+15 -7) </details> ### 📄 Description ### Summary In #6784, CIDR address support was introduced for Host records, allowing a prefix to expand into up to `randomCount` unique random host IPs. When `randomCount > 1`, the endpoint builder appended an incremental index suffix (` - 1`, ` - 2`, etc.) to the host's remark. This PR removes the automatic remark suffixing so that the user's configured remark is preserved as-is across all generated endpoints, both in subscription formats and tunnel preview configs. ### Changes - **Backend (`internal/sub/host_sub.go`)**: In `hostEndpointMaps`, removed the index suffix mutation on `hCopy.Remark` when `len(ips) > 1`. Removed now-unused `fmt` import. - **Frontend (`frontend/src/lib/hosts/host-link.ts`)**: In `hostEndpointsFor`, preserved `record.remark` directly when expanding CIDR hosts for tunnel configs and client links. - **Tests**: - Updated `TestSub_HostCIDR_RawLinks` and `TestSub_HostCIDR_ClashAndJson` in `internal/sub/host_sub_test.go` to assert that remarks remain unsuffixed. - Updated `frontend/src/test/tunnel-host-endpoints.test.ts` to verify the expected remark value. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:09:24 +07:00
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#6527
No description provided.