Skip to content

Commit 42f4b1f

Browse files
authored
chore: release v1.5.7
chore: release v1.5.7
2 parents 6b760e0 + 63f946c commit 42f4b1f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@remnawave/backend",
3-
"version": "1.5.6",
3+
"version": "1.5.7",
44
"description": "Remnawave Panel Backend",
55
"private": false,
66
"type": "commonjs",

src/modules/subscription-template/generators/format-hosts.service.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { randomUUID } from 'node:crypto';
2+
import { customAlphabet } from 'nanoid';
23

34
import { Injectable } from '@nestjs/common';
45
import { QueryBus } from '@nestjs/cqrs';
@@ -24,7 +25,11 @@ import { IFormattedHost } from './interfaces/formatted-hosts.interface';
2425

2526
@Injectable()
2627
export class FormatHostsService {
27-
constructor(private readonly queryBus: QueryBus) {}
28+
private readonly nanoid: ReturnType<typeof customAlphabet>;
29+
30+
constructor(private readonly queryBus: QueryBus) {
31+
this.nanoid = customAlphabet('0123456789abcdefghjkmnopqrstuvwxyz', 10);
32+
}
2833

2934
public async generateFormattedHosts(
3035
config: XRayConfig,
@@ -99,7 +104,13 @@ export class FormatHostsService {
99104

100105
const remark = TemplateEngine.formarWithUser(inputHost.remark, user);
101106

102-
const address = inputHost.address;
107+
let address = inputHost.address;
108+
109+
if (address.includes(',')) {
110+
const addressList = address.split(',');
111+
address = addressList[Math.floor(Math.random() * addressList.length)].trim();
112+
}
113+
103114
const port = inputHost.port;
104115
let network = inbound.streamSettings?.network || 'tcp';
105116

@@ -177,7 +188,6 @@ export class FormatHostsService {
177188
const realitySettings = inbound.streamSettings?.realitySettings;
178189
sniFromConfig = realitySettings?.serverNames?.[0];
179190
fingerprintFromConfig = realitySettings?.fingerprint;
180-
// publicKeyFromConfig = realitySettings?.publicKey || realitySettings?.password;
181191

182192
publicKeyFromConfig = publicKeyMap.get(inbound.tag);
183193

@@ -234,6 +244,10 @@ export class FormatHostsService {
234244
sni = inputHost.address;
235245
}
236246

247+
if (sni.includes('*.')) {
248+
sni = sni.replace('*', this.nanoid());
249+
}
250+
237251
// Fingerprint
238252
const fp = inputHost.fingerprint || fingerprintFromConfig || '';
239253

0 commit comments

Comments
 (0)