@subconverter/core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/index.cjs +792 -486
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -4
- package/dist/index.d.ts +47 -4
- package/dist/index.js +792 -486
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -189,6 +189,13 @@ interface RulesetContent {
|
|
|
189
189
|
/** Create a ruleset config with subconverter's defaults. */
|
|
190
190
|
declare function createRulesetConfig(): RulesetConfig;
|
|
191
191
|
|
|
192
|
+
/** Clash kernel flavor targeted by Clash output (`flavor=`). */
|
|
193
|
+
type ClashFlavor = "mihomo" | "premium" | "stash";
|
|
194
|
+
/**
|
|
195
|
+
* Parse a `flavor=` value (case-insensitive); unknown values fall back to
|
|
196
|
+
* `mihomo`, mirroring subconverter-rs `ClashFlavor::from_str`.
|
|
197
|
+
*/
|
|
198
|
+
declare function parseClashFlavor(value: string | undefined | null): ClashFlavor;
|
|
192
199
|
/** A regex/script rewrite rule, mirroring `RegexMatchConfig`. */
|
|
193
200
|
interface RegexMatchConfig {
|
|
194
201
|
match: string;
|
|
@@ -244,6 +251,8 @@ interface ExtraSettings {
|
|
|
244
251
|
includeRemarks: string[];
|
|
245
252
|
/** Drop nodes matching one of these remark rules. */
|
|
246
253
|
excludeRemarks: string[];
|
|
254
|
+
/** `false` keeps remote rulesets as `RULE-SET` references (Surge-family). */
|
|
255
|
+
expandRulesets: boolean;
|
|
247
256
|
appendProxyType: boolean;
|
|
248
257
|
nodeList: boolean;
|
|
249
258
|
sortFlag: boolean;
|
|
@@ -251,6 +260,10 @@ interface ExtraSettings {
|
|
|
251
260
|
clashNewFieldName: boolean;
|
|
252
261
|
clashScript: boolean;
|
|
253
262
|
clashClassicalRuleset: boolean;
|
|
263
|
+
/** Target Clash kernel: dropped protocols/fields follow its capabilities. */
|
|
264
|
+
clashFlavor: ClashFlavor;
|
|
265
|
+
/** Template variables applied to `{{ var }}` placeholders in base configs. */
|
|
266
|
+
templateVars: Record<string, string>;
|
|
254
267
|
dedupe: boolean;
|
|
255
268
|
surgeSsrPath: string;
|
|
256
269
|
managedConfigPrefix: string;
|
|
@@ -299,6 +312,16 @@ interface RequestSettings {
|
|
|
299
312
|
tls13: TriBool;
|
|
300
313
|
newFieldName: boolean;
|
|
301
314
|
classicalRuleset: boolean;
|
|
315
|
+
/** Target Clash kernel (`flavor=`): mihomo (default), premium, or stash. */
|
|
316
|
+
clashFlavor: ClashFlavor;
|
|
317
|
+
/** `false` keeps remote rulesets as `RULE-SET` references (Surge-family). */
|
|
318
|
+
expand: boolean;
|
|
319
|
+
/** Managed-config `strict=` flag for Surge-family `#!MANAGED-CONFIG`. */
|
|
320
|
+
strict: boolean;
|
|
321
|
+
/** Download filename override (`filename=`). */
|
|
322
|
+
filename: string;
|
|
323
|
+
/** Quantumult X device ID for remote-script signatures (`dev_id=`). */
|
|
324
|
+
devId: string;
|
|
302
325
|
insert: boolean;
|
|
303
326
|
mixin: string;
|
|
304
327
|
interval: number;
|
|
@@ -376,7 +399,7 @@ declare function trim(input: string): string;
|
|
|
376
399
|
declare function trimLowerCase(input: string): string;
|
|
377
400
|
/** Parse the leading integer of a string; `0` when none is present. */
|
|
378
401
|
declare function toInt(value: string | number | undefined | null): number;
|
|
379
|
-
/** Parse a boolean-ish value ("true"/"
|
|
402
|
+
/** Parse a boolean-ish value ("true"/"yes"/"1"/"on" and the matching negatives). */
|
|
380
403
|
declare function toBool(value: string | undefined | null): boolean;
|
|
381
404
|
/** `true` when `needle` occurs in `haystack`. */
|
|
382
405
|
declare function strFind(haystack: string, needle: string): boolean;
|
|
@@ -460,6 +483,13 @@ declare function hasTemplatePlaceholders(content: string): boolean;
|
|
|
460
483
|
/** Collect the variable names referenced by a template body. */
|
|
461
484
|
declare function templateVariableNames(content: string): string[];
|
|
462
485
|
|
|
486
|
+
/** `ruleset=` dialect prefixes (`surge:`, `quanx:`, `clash-domain:`, …). */
|
|
487
|
+
declare const RULESET_TYPE_PREFIXES: ReadonlyArray<readonly [string, RulesetType]>;
|
|
488
|
+
/** Split a ruleset source into its dialect prefix plus the bare URL/content. */
|
|
489
|
+
declare function parseRulesetSource(source: string): {
|
|
490
|
+
url: string;
|
|
491
|
+
type?: RulesetType;
|
|
492
|
+
};
|
|
463
493
|
/** A parsed subconverter external configuration file. */
|
|
464
494
|
interface ExternalConfig {
|
|
465
495
|
groups: ProxyGroupConfig[];
|
|
@@ -892,6 +922,12 @@ declare function explodeTrojan(trojan: string, node: Proxy): void;
|
|
|
892
922
|
declare function explodeHysteria2(link: string, node: Proxy): void;
|
|
893
923
|
/** Parse an `anytls://` link. */
|
|
894
924
|
declare function explodeAnyTls(link: string, node: Proxy): void;
|
|
925
|
+
/** Parse a `snell://psk@host:port?...` link. */
|
|
926
|
+
declare function explodeSnell(link: string, node: Proxy): void;
|
|
927
|
+
/** Parse a `hysteria://host:port?...` (v1) link. */
|
|
928
|
+
declare function explodeHysteria(link: string, node: Proxy): void;
|
|
929
|
+
/** Parse a `wg://` / `wireguard://host:port?...` link. */
|
|
930
|
+
declare function explodeWireguard(link: string, node: Proxy): void;
|
|
895
931
|
/** Parse a `vless://` link. */
|
|
896
932
|
declare function explodeVless(link: string, node: Proxy): void;
|
|
897
933
|
/** Parse a `tuic://` link. */
|
|
@@ -980,13 +1016,13 @@ declare function convertRuleset(content: string, type: RulesetType): string;
|
|
|
980
1016
|
/** Rewrite `TYPE,VALUE[,flag]` into `TYPE,VALUE,GROUP[,flag]`. */
|
|
981
1017
|
declare function transformRuleToCommon(input: string, group: string, noResolveOnly?: boolean): string;
|
|
982
1018
|
/** Convert rulesets into an ordered list of Clash rule strings. */
|
|
983
|
-
declare function rulesetToClashRules(rulesets: RulesetContent[]): string[];
|
|
1019
|
+
declare function rulesetToClashRules(rulesets: RulesetContent[], classical?: boolean): string[];
|
|
984
1020
|
interface SurgeRulesetResult {
|
|
985
1021
|
section: string;
|
|
986
1022
|
lines: string[];
|
|
987
1023
|
}
|
|
988
1024
|
/** Convert rulesets into Surge/QuanX/Quan/Loon rule lines. */
|
|
989
|
-
declare function rulesetToSurgeRules(rulesets: RulesetContent[], surgeVersion: number): SurgeRulesetResult;
|
|
1025
|
+
declare function rulesetToSurgeRules(rulesets: RulesetContent[], surgeVersion: number, expand?: boolean): SurgeRulesetResult;
|
|
990
1026
|
declare const SING_BOX_RULE_TYPES: string[];
|
|
991
1027
|
/** A sing-box `route` fragment produced from rulesets. */
|
|
992
1028
|
interface SingBoxRoute {
|
|
@@ -1106,6 +1142,13 @@ declare function proxyToSsSub(nodes: Proxy[], baseConf: string): string;
|
|
|
1106
1142
|
/** Export Shadowsocks nodes as an `ssd://` document. */
|
|
1107
1143
|
declare function proxyToSsd(nodes: Proxy[], group: string, userinfo: string): string;
|
|
1108
1144
|
|
|
1145
|
+
/**
|
|
1146
|
+
* Patterns known to blow up the regex engine (mirrors subconverter-rs
|
|
1147
|
+
* `REGEX_BLACK_LIST`); requests carrying them are rejected outright.
|
|
1148
|
+
*/
|
|
1149
|
+
declare const REGEX_BLACKLIST: readonly string[];
|
|
1150
|
+
/** `true` when `pattern` exactly matches a blacklisted catastrophic pattern. */
|
|
1151
|
+
declare function isBlacklistedPattern(pattern: string): boolean;
|
|
1109
1152
|
/** Does `target` fall within a subconverter range expression like `1-5,8,!3`? */
|
|
1110
1153
|
declare function matchRange(range: string, target: number): boolean;
|
|
1111
1154
|
/**
|
|
@@ -1208,4 +1251,4 @@ declare function hasRegionName(remark: string): boolean;
|
|
|
1208
1251
|
*/
|
|
1209
1252
|
declare function formatCountryRemark(remark: string, code: string): string;
|
|
1210
1253
|
|
|
1211
|
-
export { BalanceStrategy, CLASH_RULE_TYPES, DEFAULT_GROUPS, type ExternalConfig, type ExtraSettings, type GenerateOptions, type IniDocument, type IniSection, type LoonOptions, type MellowOptions, type Proxy, type ProxyGroupConfig, ProxyGroupType, ProxyType, QUANX_RULE_TYPES, type QuanOptions, type QuanxOptions, type RawIniSection, type RegexMatchConfig, type RequestSettings, type RulesetConfig, type RulesetContent, RulesetType, SING_BOX_RULE_TYPES, SSR_CIPHERS, SS_CIPHERS, SURF_RULE_TYPES, SURGE2_RULE_TYPES, SURGE_RULE_TYPES, type SingBoxOptions, type SingBoxRoute, type SurfboardOptions, type SurgeRulesetResult, TargetFormat, type TemplateVars, type TriBool, type UserinfoData, type UserinfoProvider, addCountryPrefix, addEmoji, anyTlsConstruct, applyMatcher, base64Decode, base64Encode, buildClash, checkIgnore, convertRuleset, convertUserinfo, countOccurrences, createExtraSettings, createProxy, createProxyGroupConfig, createRequestSettings, createRulesetConfig, createSelectGroup, dedupeNodes, explode, explodeAnyTls, explodeClash, explodeHttp, explodeHttpSub, explodeHysteria2, explodeKitsunebi, explodeNetch, explodeNetchConf, explodeQuan, explodeShadowrocket, explodeSocks, explodeSs, explodeSsAndroid, explodeSsConf, explodeSsd, explodeSsr, explodeSsrConf, explodeSstap, explodeStdVmess, explodeSub, explodeSurge, explodeTrojan, explodeTuic, explodeVless, explodeVmess, explodeVmessConf, filterNodes, filterNodesByCountry, findSection, fnv1a64, fnv1a64Hex, formatCountryRemark, formatSingBoxInterval, formatSubscriptionUserinfo, generate, generatePeer, getAllUrlArgs, getDefaultProxyGroups, getDefaultRulesetConfigs, getDefaultRulesets, getSectionItems, getUrlArg, groupGenerate, hasRegionName, hasTemplatePlaceholders, httpConstruct, hysteria2Construct, hysteriaConstruct, inferUserinfoProviderFromUrl, isBlank, isFlattenableSsr, isIp, isIpv4, isIpv6, isLink, isRegionCode, isSsCipher, matchRange, nextMonthlyResetTimestamp, nodeNameRegex, nodeNameRemove, nodeRename, normalizeCountryCode, normalizeQueryKey, normalizeUserinfoProvider, pad2, parseClashText, parseConfContent, parseCustomProxyGroup, parseExternalConfig, parseGroupTimes, parseIni, parseJmsUserinfo, parseLink, parsePeers, parseProxyGroupType, parseRawIni, parseRegexMatch, parseRequestSettings, parseRulesetConfig, parseSubscription, parseSubscriptionUserinfo, parseTriBool, preprocessNodes, processRemark, proxyToSingle, proxyToSsSub, proxyToSsd, proxyTypeName, queryBoolFlag, regMatch, regReplace, removeEmoji, renderRawIni, renderTemplate, replaceAllDistinct, resolveNewFieldName, rulesetToClashRules, rulesetToSingBoxRules, rulesetToSurgeRules, runPreprocess, setRawSection, snellConstruct, socksConstruct, split, splitUrl, ssConstruct, ssLinkConstruct, ssrConstruct, ssrLinkConstruct, startsWith, strFind, stringifyClash, stripScheme, templateVariableNames, toBool, toClash, toInt, toLoon, toMellow, toQuan, toQuanX, toSingBox, toSip008, toSurfboard, toSurge, transformRuleToCommon, triBoolOr, trim, trimLowerCase, trojanConstruct, trojanLinkConstruct, tryBase64Decode, tuicConstruct, urlDecode, urlEncode, urlSafeBase64Decode, urlSafeBase64Encode, utf8Decode, utf8Encode, vlessConstruct, vmessConstruct, vmessLinkConstruct, wireGuardConstruct };
|
|
1254
|
+
export { BalanceStrategy, CLASH_RULE_TYPES, type ClashFlavor, DEFAULT_GROUPS, type ExternalConfig, type ExtraSettings, type GenerateOptions, type IniDocument, type IniSection, type LoonOptions, type MellowOptions, type Proxy, type ProxyGroupConfig, ProxyGroupType, ProxyType, QUANX_RULE_TYPES, type QuanOptions, type QuanxOptions, REGEX_BLACKLIST, RULESET_TYPE_PREFIXES, type RawIniSection, type RegexMatchConfig, type RequestSettings, type RulesetConfig, type RulesetContent, RulesetType, SING_BOX_RULE_TYPES, SSR_CIPHERS, SS_CIPHERS, SURF_RULE_TYPES, SURGE2_RULE_TYPES, SURGE_RULE_TYPES, type SingBoxOptions, type SingBoxRoute, type SurfboardOptions, type SurgeRulesetResult, TargetFormat, type TemplateVars, type TriBool, type UserinfoData, type UserinfoProvider, addCountryPrefix, addEmoji, anyTlsConstruct, applyMatcher, base64Decode, base64Encode, buildClash, checkIgnore, convertRuleset, convertUserinfo, countOccurrences, createExtraSettings, createProxy, createProxyGroupConfig, createRequestSettings, createRulesetConfig, createSelectGroup, dedupeNodes, explode, explodeAnyTls, explodeClash, explodeHttp, explodeHttpSub, explodeHysteria, explodeHysteria2, explodeKitsunebi, explodeNetch, explodeNetchConf, explodeQuan, explodeShadowrocket, explodeSnell, explodeSocks, explodeSs, explodeSsAndroid, explodeSsConf, explodeSsd, explodeSsr, explodeSsrConf, explodeSstap, explodeStdVmess, explodeSub, explodeSurge, explodeTrojan, explodeTuic, explodeVless, explodeVmess, explodeVmessConf, explodeWireguard, filterNodes, filterNodesByCountry, findSection, fnv1a64, fnv1a64Hex, formatCountryRemark, formatSingBoxInterval, formatSubscriptionUserinfo, generate, generatePeer, getAllUrlArgs, getDefaultProxyGroups, getDefaultRulesetConfigs, getDefaultRulesets, getSectionItems, getUrlArg, groupGenerate, hasRegionName, hasTemplatePlaceholders, httpConstruct, hysteria2Construct, hysteriaConstruct, inferUserinfoProviderFromUrl, isBlacklistedPattern, isBlank, isFlattenableSsr, isIp, isIpv4, isIpv6, isLink, isRegionCode, isSsCipher, matchRange, nextMonthlyResetTimestamp, nodeNameRegex, nodeNameRemove, nodeRename, normalizeCountryCode, normalizeQueryKey, normalizeUserinfoProvider, pad2, parseClashFlavor, parseClashText, parseConfContent, parseCustomProxyGroup, parseExternalConfig, parseGroupTimes, parseIni, parseJmsUserinfo, parseLink, parsePeers, parseProxyGroupType, parseRawIni, parseRegexMatch, parseRequestSettings, parseRulesetConfig, parseRulesetSource, parseSubscription, parseSubscriptionUserinfo, parseTriBool, preprocessNodes, processRemark, proxyToSingle, proxyToSsSub, proxyToSsd, proxyTypeName, queryBoolFlag, regMatch, regReplace, removeEmoji, renderRawIni, renderTemplate, replaceAllDistinct, resolveNewFieldName, rulesetToClashRules, rulesetToSingBoxRules, rulesetToSurgeRules, runPreprocess, setRawSection, snellConstruct, socksConstruct, split, splitUrl, ssConstruct, ssLinkConstruct, ssrConstruct, ssrLinkConstruct, startsWith, strFind, stringifyClash, stripScheme, templateVariableNames, toBool, toClash, toInt, toLoon, toMellow, toQuan, toQuanX, toSingBox, toSip008, toSurfboard, toSurge, transformRuleToCommon, triBoolOr, trim, trimLowerCase, trojanConstruct, trojanLinkConstruct, tryBase64Decode, tuicConstruct, urlDecode, urlEncode, urlSafeBase64Decode, urlSafeBase64Encode, utf8Decode, utf8Encode, vlessConstruct, vmessConstruct, vmessLinkConstruct, wireGuardConstruct };
|
package/dist/index.d.ts
CHANGED
|
@@ -189,6 +189,13 @@ interface RulesetContent {
|
|
|
189
189
|
/** Create a ruleset config with subconverter's defaults. */
|
|
190
190
|
declare function createRulesetConfig(): RulesetConfig;
|
|
191
191
|
|
|
192
|
+
/** Clash kernel flavor targeted by Clash output (`flavor=`). */
|
|
193
|
+
type ClashFlavor = "mihomo" | "premium" | "stash";
|
|
194
|
+
/**
|
|
195
|
+
* Parse a `flavor=` value (case-insensitive); unknown values fall back to
|
|
196
|
+
* `mihomo`, mirroring subconverter-rs `ClashFlavor::from_str`.
|
|
197
|
+
*/
|
|
198
|
+
declare function parseClashFlavor(value: string | undefined | null): ClashFlavor;
|
|
192
199
|
/** A regex/script rewrite rule, mirroring `RegexMatchConfig`. */
|
|
193
200
|
interface RegexMatchConfig {
|
|
194
201
|
match: string;
|
|
@@ -244,6 +251,8 @@ interface ExtraSettings {
|
|
|
244
251
|
includeRemarks: string[];
|
|
245
252
|
/** Drop nodes matching one of these remark rules. */
|
|
246
253
|
excludeRemarks: string[];
|
|
254
|
+
/** `false` keeps remote rulesets as `RULE-SET` references (Surge-family). */
|
|
255
|
+
expandRulesets: boolean;
|
|
247
256
|
appendProxyType: boolean;
|
|
248
257
|
nodeList: boolean;
|
|
249
258
|
sortFlag: boolean;
|
|
@@ -251,6 +260,10 @@ interface ExtraSettings {
|
|
|
251
260
|
clashNewFieldName: boolean;
|
|
252
261
|
clashScript: boolean;
|
|
253
262
|
clashClassicalRuleset: boolean;
|
|
263
|
+
/** Target Clash kernel: dropped protocols/fields follow its capabilities. */
|
|
264
|
+
clashFlavor: ClashFlavor;
|
|
265
|
+
/** Template variables applied to `{{ var }}` placeholders in base configs. */
|
|
266
|
+
templateVars: Record<string, string>;
|
|
254
267
|
dedupe: boolean;
|
|
255
268
|
surgeSsrPath: string;
|
|
256
269
|
managedConfigPrefix: string;
|
|
@@ -299,6 +312,16 @@ interface RequestSettings {
|
|
|
299
312
|
tls13: TriBool;
|
|
300
313
|
newFieldName: boolean;
|
|
301
314
|
classicalRuleset: boolean;
|
|
315
|
+
/** Target Clash kernel (`flavor=`): mihomo (default), premium, or stash. */
|
|
316
|
+
clashFlavor: ClashFlavor;
|
|
317
|
+
/** `false` keeps remote rulesets as `RULE-SET` references (Surge-family). */
|
|
318
|
+
expand: boolean;
|
|
319
|
+
/** Managed-config `strict=` flag for Surge-family `#!MANAGED-CONFIG`. */
|
|
320
|
+
strict: boolean;
|
|
321
|
+
/** Download filename override (`filename=`). */
|
|
322
|
+
filename: string;
|
|
323
|
+
/** Quantumult X device ID for remote-script signatures (`dev_id=`). */
|
|
324
|
+
devId: string;
|
|
302
325
|
insert: boolean;
|
|
303
326
|
mixin: string;
|
|
304
327
|
interval: number;
|
|
@@ -376,7 +399,7 @@ declare function trim(input: string): string;
|
|
|
376
399
|
declare function trimLowerCase(input: string): string;
|
|
377
400
|
/** Parse the leading integer of a string; `0` when none is present. */
|
|
378
401
|
declare function toInt(value: string | number | undefined | null): number;
|
|
379
|
-
/** Parse a boolean-ish value ("true"/"
|
|
402
|
+
/** Parse a boolean-ish value ("true"/"yes"/"1"/"on" and the matching negatives). */
|
|
380
403
|
declare function toBool(value: string | undefined | null): boolean;
|
|
381
404
|
/** `true` when `needle` occurs in `haystack`. */
|
|
382
405
|
declare function strFind(haystack: string, needle: string): boolean;
|
|
@@ -460,6 +483,13 @@ declare function hasTemplatePlaceholders(content: string): boolean;
|
|
|
460
483
|
/** Collect the variable names referenced by a template body. */
|
|
461
484
|
declare function templateVariableNames(content: string): string[];
|
|
462
485
|
|
|
486
|
+
/** `ruleset=` dialect prefixes (`surge:`, `quanx:`, `clash-domain:`, …). */
|
|
487
|
+
declare const RULESET_TYPE_PREFIXES: ReadonlyArray<readonly [string, RulesetType]>;
|
|
488
|
+
/** Split a ruleset source into its dialect prefix plus the bare URL/content. */
|
|
489
|
+
declare function parseRulesetSource(source: string): {
|
|
490
|
+
url: string;
|
|
491
|
+
type?: RulesetType;
|
|
492
|
+
};
|
|
463
493
|
/** A parsed subconverter external configuration file. */
|
|
464
494
|
interface ExternalConfig {
|
|
465
495
|
groups: ProxyGroupConfig[];
|
|
@@ -892,6 +922,12 @@ declare function explodeTrojan(trojan: string, node: Proxy): void;
|
|
|
892
922
|
declare function explodeHysteria2(link: string, node: Proxy): void;
|
|
893
923
|
/** Parse an `anytls://` link. */
|
|
894
924
|
declare function explodeAnyTls(link: string, node: Proxy): void;
|
|
925
|
+
/** Parse a `snell://psk@host:port?...` link. */
|
|
926
|
+
declare function explodeSnell(link: string, node: Proxy): void;
|
|
927
|
+
/** Parse a `hysteria://host:port?...` (v1) link. */
|
|
928
|
+
declare function explodeHysteria(link: string, node: Proxy): void;
|
|
929
|
+
/** Parse a `wg://` / `wireguard://host:port?...` link. */
|
|
930
|
+
declare function explodeWireguard(link: string, node: Proxy): void;
|
|
895
931
|
/** Parse a `vless://` link. */
|
|
896
932
|
declare function explodeVless(link: string, node: Proxy): void;
|
|
897
933
|
/** Parse a `tuic://` link. */
|
|
@@ -980,13 +1016,13 @@ declare function convertRuleset(content: string, type: RulesetType): string;
|
|
|
980
1016
|
/** Rewrite `TYPE,VALUE[,flag]` into `TYPE,VALUE,GROUP[,flag]`. */
|
|
981
1017
|
declare function transformRuleToCommon(input: string, group: string, noResolveOnly?: boolean): string;
|
|
982
1018
|
/** Convert rulesets into an ordered list of Clash rule strings. */
|
|
983
|
-
declare function rulesetToClashRules(rulesets: RulesetContent[]): string[];
|
|
1019
|
+
declare function rulesetToClashRules(rulesets: RulesetContent[], classical?: boolean): string[];
|
|
984
1020
|
interface SurgeRulesetResult {
|
|
985
1021
|
section: string;
|
|
986
1022
|
lines: string[];
|
|
987
1023
|
}
|
|
988
1024
|
/** Convert rulesets into Surge/QuanX/Quan/Loon rule lines. */
|
|
989
|
-
declare function rulesetToSurgeRules(rulesets: RulesetContent[], surgeVersion: number): SurgeRulesetResult;
|
|
1025
|
+
declare function rulesetToSurgeRules(rulesets: RulesetContent[], surgeVersion: number, expand?: boolean): SurgeRulesetResult;
|
|
990
1026
|
declare const SING_BOX_RULE_TYPES: string[];
|
|
991
1027
|
/** A sing-box `route` fragment produced from rulesets. */
|
|
992
1028
|
interface SingBoxRoute {
|
|
@@ -1106,6 +1142,13 @@ declare function proxyToSsSub(nodes: Proxy[], baseConf: string): string;
|
|
|
1106
1142
|
/** Export Shadowsocks nodes as an `ssd://` document. */
|
|
1107
1143
|
declare function proxyToSsd(nodes: Proxy[], group: string, userinfo: string): string;
|
|
1108
1144
|
|
|
1145
|
+
/**
|
|
1146
|
+
* Patterns known to blow up the regex engine (mirrors subconverter-rs
|
|
1147
|
+
* `REGEX_BLACK_LIST`); requests carrying them are rejected outright.
|
|
1148
|
+
*/
|
|
1149
|
+
declare const REGEX_BLACKLIST: readonly string[];
|
|
1150
|
+
/** `true` when `pattern` exactly matches a blacklisted catastrophic pattern. */
|
|
1151
|
+
declare function isBlacklistedPattern(pattern: string): boolean;
|
|
1109
1152
|
/** Does `target` fall within a subconverter range expression like `1-5,8,!3`? */
|
|
1110
1153
|
declare function matchRange(range: string, target: number): boolean;
|
|
1111
1154
|
/**
|
|
@@ -1208,4 +1251,4 @@ declare function hasRegionName(remark: string): boolean;
|
|
|
1208
1251
|
*/
|
|
1209
1252
|
declare function formatCountryRemark(remark: string, code: string): string;
|
|
1210
1253
|
|
|
1211
|
-
export { BalanceStrategy, CLASH_RULE_TYPES, DEFAULT_GROUPS, type ExternalConfig, type ExtraSettings, type GenerateOptions, type IniDocument, type IniSection, type LoonOptions, type MellowOptions, type Proxy, type ProxyGroupConfig, ProxyGroupType, ProxyType, QUANX_RULE_TYPES, type QuanOptions, type QuanxOptions, type RawIniSection, type RegexMatchConfig, type RequestSettings, type RulesetConfig, type RulesetContent, RulesetType, SING_BOX_RULE_TYPES, SSR_CIPHERS, SS_CIPHERS, SURF_RULE_TYPES, SURGE2_RULE_TYPES, SURGE_RULE_TYPES, type SingBoxOptions, type SingBoxRoute, type SurfboardOptions, type SurgeRulesetResult, TargetFormat, type TemplateVars, type TriBool, type UserinfoData, type UserinfoProvider, addCountryPrefix, addEmoji, anyTlsConstruct, applyMatcher, base64Decode, base64Encode, buildClash, checkIgnore, convertRuleset, convertUserinfo, countOccurrences, createExtraSettings, createProxy, createProxyGroupConfig, createRequestSettings, createRulesetConfig, createSelectGroup, dedupeNodes, explode, explodeAnyTls, explodeClash, explodeHttp, explodeHttpSub, explodeHysteria2, explodeKitsunebi, explodeNetch, explodeNetchConf, explodeQuan, explodeShadowrocket, explodeSocks, explodeSs, explodeSsAndroid, explodeSsConf, explodeSsd, explodeSsr, explodeSsrConf, explodeSstap, explodeStdVmess, explodeSub, explodeSurge, explodeTrojan, explodeTuic, explodeVless, explodeVmess, explodeVmessConf, filterNodes, filterNodesByCountry, findSection, fnv1a64, fnv1a64Hex, formatCountryRemark, formatSingBoxInterval, formatSubscriptionUserinfo, generate, generatePeer, getAllUrlArgs, getDefaultProxyGroups, getDefaultRulesetConfigs, getDefaultRulesets, getSectionItems, getUrlArg, groupGenerate, hasRegionName, hasTemplatePlaceholders, httpConstruct, hysteria2Construct, hysteriaConstruct, inferUserinfoProviderFromUrl, isBlank, isFlattenableSsr, isIp, isIpv4, isIpv6, isLink, isRegionCode, isSsCipher, matchRange, nextMonthlyResetTimestamp, nodeNameRegex, nodeNameRemove, nodeRename, normalizeCountryCode, normalizeQueryKey, normalizeUserinfoProvider, pad2, parseClashText, parseConfContent, parseCustomProxyGroup, parseExternalConfig, parseGroupTimes, parseIni, parseJmsUserinfo, parseLink, parsePeers, parseProxyGroupType, parseRawIni, parseRegexMatch, parseRequestSettings, parseRulesetConfig, parseSubscription, parseSubscriptionUserinfo, parseTriBool, preprocessNodes, processRemark, proxyToSingle, proxyToSsSub, proxyToSsd, proxyTypeName, queryBoolFlag, regMatch, regReplace, removeEmoji, renderRawIni, renderTemplate, replaceAllDistinct, resolveNewFieldName, rulesetToClashRules, rulesetToSingBoxRules, rulesetToSurgeRules, runPreprocess, setRawSection, snellConstruct, socksConstruct, split, splitUrl, ssConstruct, ssLinkConstruct, ssrConstruct, ssrLinkConstruct, startsWith, strFind, stringifyClash, stripScheme, templateVariableNames, toBool, toClash, toInt, toLoon, toMellow, toQuan, toQuanX, toSingBox, toSip008, toSurfboard, toSurge, transformRuleToCommon, triBoolOr, trim, trimLowerCase, trojanConstruct, trojanLinkConstruct, tryBase64Decode, tuicConstruct, urlDecode, urlEncode, urlSafeBase64Decode, urlSafeBase64Encode, utf8Decode, utf8Encode, vlessConstruct, vmessConstruct, vmessLinkConstruct, wireGuardConstruct };
|
|
1254
|
+
export { BalanceStrategy, CLASH_RULE_TYPES, type ClashFlavor, DEFAULT_GROUPS, type ExternalConfig, type ExtraSettings, type GenerateOptions, type IniDocument, type IniSection, type LoonOptions, type MellowOptions, type Proxy, type ProxyGroupConfig, ProxyGroupType, ProxyType, QUANX_RULE_TYPES, type QuanOptions, type QuanxOptions, REGEX_BLACKLIST, RULESET_TYPE_PREFIXES, type RawIniSection, type RegexMatchConfig, type RequestSettings, type RulesetConfig, type RulesetContent, RulesetType, SING_BOX_RULE_TYPES, SSR_CIPHERS, SS_CIPHERS, SURF_RULE_TYPES, SURGE2_RULE_TYPES, SURGE_RULE_TYPES, type SingBoxOptions, type SingBoxRoute, type SurfboardOptions, type SurgeRulesetResult, TargetFormat, type TemplateVars, type TriBool, type UserinfoData, type UserinfoProvider, addCountryPrefix, addEmoji, anyTlsConstruct, applyMatcher, base64Decode, base64Encode, buildClash, checkIgnore, convertRuleset, convertUserinfo, countOccurrences, createExtraSettings, createProxy, createProxyGroupConfig, createRequestSettings, createRulesetConfig, createSelectGroup, dedupeNodes, explode, explodeAnyTls, explodeClash, explodeHttp, explodeHttpSub, explodeHysteria, explodeHysteria2, explodeKitsunebi, explodeNetch, explodeNetchConf, explodeQuan, explodeShadowrocket, explodeSnell, explodeSocks, explodeSs, explodeSsAndroid, explodeSsConf, explodeSsd, explodeSsr, explodeSsrConf, explodeSstap, explodeStdVmess, explodeSub, explodeSurge, explodeTrojan, explodeTuic, explodeVless, explodeVmess, explodeVmessConf, explodeWireguard, filterNodes, filterNodesByCountry, findSection, fnv1a64, fnv1a64Hex, formatCountryRemark, formatSingBoxInterval, formatSubscriptionUserinfo, generate, generatePeer, getAllUrlArgs, getDefaultProxyGroups, getDefaultRulesetConfigs, getDefaultRulesets, getSectionItems, getUrlArg, groupGenerate, hasRegionName, hasTemplatePlaceholders, httpConstruct, hysteria2Construct, hysteriaConstruct, inferUserinfoProviderFromUrl, isBlacklistedPattern, isBlank, isFlattenableSsr, isIp, isIpv4, isIpv6, isLink, isRegionCode, isSsCipher, matchRange, nextMonthlyResetTimestamp, nodeNameRegex, nodeNameRemove, nodeRename, normalizeCountryCode, normalizeQueryKey, normalizeUserinfoProvider, pad2, parseClashFlavor, parseClashText, parseConfContent, parseCustomProxyGroup, parseExternalConfig, parseGroupTimes, parseIni, parseJmsUserinfo, parseLink, parsePeers, parseProxyGroupType, parseRawIni, parseRegexMatch, parseRequestSettings, parseRulesetConfig, parseRulesetSource, parseSubscription, parseSubscriptionUserinfo, parseTriBool, preprocessNodes, processRemark, proxyToSingle, proxyToSsSub, proxyToSsd, proxyTypeName, queryBoolFlag, regMatch, regReplace, removeEmoji, renderRawIni, renderTemplate, replaceAllDistinct, resolveNewFieldName, rulesetToClashRules, rulesetToSingBoxRules, rulesetToSurgeRules, runPreprocess, setRawSection, snellConstruct, socksConstruct, split, splitUrl, ssConstruct, ssLinkConstruct, ssrConstruct, ssrLinkConstruct, startsWith, strFind, stringifyClash, stripScheme, templateVariableNames, toBool, toClash, toInt, toLoon, toMellow, toQuan, toQuanX, toSingBox, toSip008, toSurfboard, toSurge, transformRuleToCommon, triBoolOr, trim, trimLowerCase, trojanConstruct, trojanLinkConstruct, tryBase64Decode, tuicConstruct, urlDecode, urlEncode, urlSafeBase64Decode, urlSafeBase64Encode, utf8Decode, utf8Encode, vlessConstruct, vmessConstruct, vmessLinkConstruct, wireGuardConstruct };
|