From 29e776a0ecc4e3d4be2a937b68e41905bb1b63d8 Mon Sep 17 00:00:00 2001 From: Den Piligrim <89912505+vasiljevdenis@users.noreply.github.com> Date: Sat, 21 Mar 2026 15:06:13 +0300 Subject: [PATCH] fix sni --- server/src/client/client.controller.ts | 2 +- server/src/inbounds/inbound-builder.service.ts | 2 +- server/src/rotation/rotation.service.ts | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/server/src/client/client.controller.ts b/server/src/client/client.controller.ts index 46493ae..c32f912 100644 --- a/server/src/client/client.controller.ts +++ b/server/src/client/client.controller.ts @@ -267,7 +267,7 @@ export class ClientController { } catch (e) { return link; } - } else if (link.startsWith('vless://') || link.startsWith('trojan://')) { + } else if (link.startsWith('vless://') || link.startsWith('trojan://') || link.startsWith('hy2://')) { return link.replace(/@.*?:/, `@${newHost}:`); } else if (link.startsWith('ss://')) { if (link.includes('@')) { diff --git a/server/src/inbounds/inbound-builder.service.ts b/server/src/inbounds/inbound-builder.service.ts index adc00ad..c337f3c 100644 --- a/server/src/inbounds/inbound-builder.service.ts +++ b/server/src/inbounds/inbound-builder.service.ts @@ -516,6 +516,6 @@ export class InboundBuilderService { params.set('obfs', obfs); params.set('obfs-password', obfsPass); - return `hy2://${auth}@${serverAddress}:${port}/?${params.toString()}#${this.flag}%20${encodeURIComponent(remark)}`; + return `hy2://${auth}@${serverAddress}:${port}/?${params.toString()}#${remark}`; } } \ No newline at end of file diff --git a/server/src/rotation/rotation.service.ts b/server/src/rotation/rotation.service.ts index 43b40e8..2933b31 100644 --- a/server/src/rotation/rotation.service.ts +++ b/server/src/rotation/rotation.service.ts @@ -134,11 +134,7 @@ private async rotateSubscription(sub: Subscription, domains: Domain[]) { const type = config.type; const uuid = uuidv4(); - // Определяем SNI - let sni = 'unknown'; - if (type !== 'custom' && type !== 'vmess-tcp' && type !== 'shadowsocks-tcp') { - sni = (!config.sni || config.sni === 'random') ? this.pickDomain(domains) : config.sni; - } + let sni = ''; // === 1. Обработка Custom === if (type === 'custom') { @@ -152,11 +148,13 @@ private async rotateSubscription(sub: Subscription, domains: Domain[]) { }); await this.inboundRepo.save(newInbound); continue; + } else { + sni = config.sni === 'random' ? this.pickDomain(domains) : config.sni; } // === 2. Обработка Hysteria2 === if (type === 'hysteria2-udp') { - const link = this.inboundBuilder.buildHysteria2Link(serverAddress, sni, 'Hysteria2'); + const link = this.inboundBuilder.buildHysteria2Link(serverAddress, sni, flagEmoji + '%20hysteria2-udp'); const newInbound = this.inboundRepo.create({ xuiId: 0, port: 0, // Обычно Hysteria висит на 443, фактический порт вытаскивается в билдере