Skip to content

Commit

Permalink
feat(): add tls13 config support to v2rayn_subscribe provider
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Jun 13, 2020
1 parent 481c7e7 commit 233876e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/provider/V2rayNSubscribeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -28,6 +29,8 @@ export default class V2rayNSubscribeProvider extends Provider {
],
})
.required(),
udpRelay: Joi.bool(),
tls13: Joi.bool(),
})
.unknown();

Expand All @@ -53,7 +56,7 @@ export default class V2rayNSubscribeProvider extends Provider {
}

public getNodeList(): ReturnType<typeof getV2rayNSubscription> {
return getV2rayNSubscription(this.url, this.compatibleMode, this.skipCertVerify, this.udpRelay);
return getV2rayNSubscription(this.url, this.compatibleMode, this.skipCertVerify, this.udpRelay, this.tls13);
}
}

Expand All @@ -65,6 +68,7 @@ export const getV2rayNSubscription = async (
isCompatibleMode?: boolean|undefined,
skipCertVerify?: boolean|undefined,
udpRelay?: boolean|undefined,
tls13?: boolean|undefined,
): Promise<ReadonlyArray<VmessNodeConfig>> => {
assert(url, '未指定订阅地址 url');

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 233876e

Please sign in to comment.