Update CDN / Download / Domestic Hosts

This commit is contained in:
SukkaW
2024-01-17 19:15:43 +08:00
parent 4ecc4f170d
commit 1c72dcb5e0
10 changed files with 93 additions and 47 deletions

View File

@@ -39,3 +39,7 @@ export const surgeRulesetToClashClassicalTextRuleset = (rules: string[] | Set<st
export const surgeDomainsetToClashDomainset = (domainset: string[]) => {
return domainset.map(i => (i[0] === '.' ? `+${i}` : i));
};
export const surgeDomainsetToClashRuleset = (domainset: string[]) => {
return domainset.map(i => (i[0] === '.' ? `DOMAIN-SUFFIX,${i.slice(1)}` : `DOMAIN,${i}`));
};

View File

@@ -27,8 +27,8 @@ export function isProbablyIpv4(hostname: string): boolean {
return (
numberOfDots === 3
&& hostname.charCodeAt(0) !== 46
&& /* '.' */ hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */
&& hostname.charCodeAt(0) !== 46 /* '.' */
&& hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */
);
}