From 233876e4b6f94237748345a09445cb766765b684 Mon Sep 17 00:00:00 2001 From: Roy Li Date: Sat, 13 Jun 2020 16:26:17 +0800 Subject: [PATCH] feat(): add tls13 config support to v2rayn_subscribe provider --- lib/provider/V2rayNSubscribeProvider.ts | 13 +++++++++---- lib/types.ts | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/provider/V2rayNSubscribeProvider.ts b/lib/provider/V2rayNSubscribeProvider.ts index 899f8337c..512cb8e5f 100644 --- a/lib/provider/V2rayNSubscribeProvider.ts +++ b/lib/provider/V2rayNSubscribeProvider.ts @@ -13,6 +13,7 @@ export default class V2rayNSubscribeProvider extends Provider { public readonly compatibleMode?: boolean; public readonly skipCertVerify?: boolean; public readonly udpRelay?: boolean; + public readonly tls13?: boolean; private readonly _url: string; @@ -28,6 +29,8 @@ export default class V2rayNSubscribeProvider extends Provider { ], }) .required(), + udpRelay: Joi.bool(), + tls13: Joi.bool(), }) .unknown(); @@ -53,7 +56,7 @@ export default class V2rayNSubscribeProvider extends Provider { } public getNodeList(): ReturnType { - return getV2rayNSubscription(this.url, this.compatibleMode, this.skipCertVerify, this.udpRelay); + return getV2rayNSubscription(this.url, this.compatibleMode, this.skipCertVerify, this.udpRelay, this.tls13); } } @@ -65,6 +68,7 @@ export const getV2rayNSubscription = async ( isCompatibleMode?: boolean|undefined, skipCertVerify?: boolean|undefined, udpRelay?: boolean|undefined, + tls13?: boolean|undefined, ): Promise> => { assert(url, '未指定订阅地址 url'); @@ -115,9 +119,10 @@ export const getV2rayNSubscription = async ( ...(udpRelay ? { udp: udpRelay, } : null), - ...(skipCertVerify ? { - skipCertVerify, - } : null), + ...(json.tls === 'tls' ? { + skipCertVerify: skipCertVerify ?? false, + tls13: tls13 ?? false, + } : null) }; }) .filter((item): item is VmessNodeConfig => !!item); diff --git a/lib/types.ts b/lib/types.ts index d7cfff781..285df2cb5 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -128,6 +128,7 @@ export interface V2rayNSubscribeProviderConfig extends ProviderConfig { readonly compatibleMode?: boolean; readonly skipCertVerify?: boolean; readonly udpRelay?: boolean; + readonly tls13?: boolean; } export interface ClashProviderConfig extends ProviderConfig {