Skip to content

Commit eb5febe

Browse files
committed
refactor: streamline xray configuration handling and improve inbound tag validation
1 parent e1e9246 commit eb5febe

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/modules/internal/internal.service.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export class InternalService {
2929
}
3030

3131
public setXrayConfig(config: Record<string, unknown>): void {
32-
this.logger.debug('Setting new xray config');
3332
this.xrayConfig = config;
3433
}
3534

@@ -48,15 +47,14 @@ export class InternalService {
4847

4948
const start = performance.now();
5049
if (newConfig.inbounds && Array.isArray(newConfig.inbounds)) {
50+
const validTags = new Set(hashPayload.inbounds.map((item) => item.tag));
51+
5152
await pMap(
5253
newConfig.inbounds,
5354
async (inbound) => {
5455
const inboundTag: string = inbound.tag;
5556

56-
if (
57-
!inboundTag ||
58-
!hashPayload.inbounds.find((item) => item.tag === inboundTag)
59-
) {
57+
if (!inboundTag || !validTags.has(inboundTag)) {
6058
return;
6159
}
6260

0 commit comments

Comments
 (0)