feat(sub): generate random IPs from CIDR host addresses (#6784)

Operators who front a server with an IP range (a CDN or anycast prefix) had to
list each address as its own host. A host address may now be a CIDR, and every
subscription fetch expands it into up to randomCount (1–100, default 1) unique
random host IPs from the range, IPv4 and IPv6 alike, skipping the network and
broadcast addresses. The panel's own previews, QR codes and tunnel config
exports (WireGuard, AmneziaWG, TUIC, MTProto) expand it the same way, and the
externalProxy importer writes the model's default count so the re-sync still
recognises untouched imported hosts.
This commit is contained in:
Pejman Yousefi 2026-10-24 06:43:44 +03:30 • committed by GitHub
parent f6a233220a
commit 40cea0c2fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 886 additions and 8 deletions

View file

@ -2758,6 +2758,10 @@
"minimum": 0,
"type": "integer"
},
"randomCount": {
"example": 1,
"type": "integer"
},
"remark": {
"example": "cdn-front",
"maxLength": 256,
@ -2830,6 +2834,7 @@
"path",
"pinnedPeerCertSha256",
"port",
"randomCount",
"remark",
"security",
"serverDescription",
@ -2939,6 +2944,11 @@
"minimum": 0,
"type": "integer"
},
"randomCount": {
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"remark": {
"maxLength": 256,
"type": "string"
@ -3004,6 +3014,7 @@
"path",
"pinnedPeerCertSha256",
"port",
"randomCount",
"remark",
"security",
"serverDescription",
@ -12004,6 +12015,7 @@
""
],
"port": 0,
"randomCount": 1,
"remark": "",
"security": "same",
"serverDescription": "",
@ -12099,6 +12111,7 @@
""
],
"port": 0,
"randomCount": 1,
"remark": "",
"security": "same",
"serverDescription": "",
@ -12197,6 +12210,7 @@
""
],
"port": 0,
"randomCount": 1,
"remark": "",
"security": "same",
"serverDescription": "",
@ -12345,6 +12359,7 @@
""
],
"port": 8443,
"randomCount": 1,
"remark": "cdn-front",
"security": "same",
"serverDescription": "",
@ -12467,6 +12482,7 @@
""
],
"port": 8443,
"randomCount": 1,
"remark": "cdn-front",
"security": "same",
"serverDescription": "",
@ -12719,6 +12735,7 @@
""
],
"port": 8443,
"randomCount": 1,
"remark": "cdn-front",
"security": "same",
"serverDescription": "",