proxylang 0.10.0 → 0.10.1
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/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { K as requestSchema, L as targetCatalog, M as compile, N as explain, V as StaticRuleSetUnknownError, Z as definitionDiagnostic, i as buildToDirectory, n as defineBuild, r as runBuild, t as checkBuild } from "./profile-build-
|
|
2
|
+
import { K as requestSchema, L as targetCatalog, M as compile, N as explain, V as StaticRuleSetUnknownError, Z as definitionDiagnostic, i as buildToDirectory, n as defineBuild, r as runBuild, t as checkBuild } from "./profile-build-BC7eIYBy.js";
|
|
3
3
|
import { lstat, open, stat } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -466,6 +466,9 @@ type SurgeCondition = {
|
|
|
466
466
|
}) | (NoSniff & {
|
|
467
467
|
readonly type: "network";
|
|
468
468
|
readonly value: "tcp" | "udp";
|
|
469
|
+
}) | (NoSniff & {
|
|
470
|
+
readonly type: "ipAsn";
|
|
471
|
+
readonly value: number;
|
|
469
472
|
}) | (NoSniff & {
|
|
470
473
|
readonly type: "all" | "any";
|
|
471
474
|
readonly conditions: readonly SurgeCondition[];
|
|
@@ -872,6 +875,10 @@ export declare const surge: {
|
|
|
872
875
|
readonly noResolve?: boolean;
|
|
873
876
|
readonly includeSniffed?: never;
|
|
874
877
|
} | undefined) => SurgeCondition;
|
|
878
|
+
ipAsn: (value: number, options?: {
|
|
879
|
+
readonly noResolve?: boolean;
|
|
880
|
+
readonly includeSniffed?: never;
|
|
881
|
+
}) => SurgeCondition;
|
|
875
882
|
sourceIp: (value: string, options?: {
|
|
876
883
|
readonly noResolve?: boolean;
|
|
877
884
|
readonly includeSniffed?: never;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as inspectDefinition, A as renderSurgeProfiles, B as validateProxyOptions, C as strategy, D as defineProfile, E as compileProfile, F as isReservedNativeName, G as nodeSchema, H as assertData, I as nativeNameSchema, J as defineProxyGroup, L as targetCatalog, M as compile, N as explain, O as compileSurgeProfile, P as compileStrategyGroups, Q as exactDefinition, R as RenderError, S as slot, T as use, U as deepFreeze, V as StaticRuleSetUnknownError, W as idSchema, X as defineRoutes, Y as defineRoute, _ as rule, a as render, b as sequence, c as direct, d as match, et as outbound, f as mihomo, g as route, h as reject, i as buildToDirectory, j as secretReader, k as renderSurgeProfile, l as dnsRule, m as proxy, n as defineBuild, o as block, p as policy, q as ProfileDefinitionError, r as runBuild, s as defineConfig, t as checkBuild, u as group, v as ruleSet, w as surge, x as singbox, y as secret, z as surgeProxy } from "./profile-build-
|
|
1
|
+
import { $ as inspectDefinition, A as renderSurgeProfiles, B as validateProxyOptions, C as strategy, D as defineProfile, E as compileProfile, F as isReservedNativeName, G as nodeSchema, H as assertData, I as nativeNameSchema, J as defineProxyGroup, L as targetCatalog, M as compile, N as explain, O as compileSurgeProfile, P as compileStrategyGroups, Q as exactDefinition, R as RenderError, S as slot, T as use, U as deepFreeze, V as StaticRuleSetUnknownError, W as idSchema, X as defineRoutes, Y as defineRoute, _ as rule, a as render, b as sequence, c as direct, d as match, et as outbound, f as mihomo, g as route, h as reject, i as buildToDirectory, j as secretReader, k as renderSurgeProfile, l as dnsRule, m as proxy, n as defineBuild, o as block, p as policy, q as ProfileDefinitionError, r as runBuild, s as defineConfig, t as checkBuild, u as group, v as ruleSet, w as surge, x as singbox, y as secret, z as surgeProxy } from "./profile-build-BC7eIYBy.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
//#region src/proxy-fragments.ts
|
|
@@ -389,6 +389,14 @@ const surgeMatch = {
|
|
|
389
389
|
domainSuffix: atom$2("domainSuffix"),
|
|
390
390
|
ipCidr: atom$2("ipCidr"),
|
|
391
391
|
ipCidr6: atom$2("ipCidr6"),
|
|
392
|
+
ipAsn: (value, options = {}) => {
|
|
393
|
+
inspectDefinition(options);
|
|
394
|
+
return condition({
|
|
395
|
+
...options,
|
|
396
|
+
type: "ipAsn",
|
|
397
|
+
value
|
|
398
|
+
});
|
|
399
|
+
},
|
|
392
400
|
sourceIp: atom$2("sourceIp"),
|
|
393
401
|
processName: atom$2("processName"),
|
|
394
402
|
macAddress: atom$2("macAddress"),
|
|
@@ -2215,6 +2223,11 @@ const conditionSchema = z.lazy(() => z.union([
|
|
|
2215
2223
|
atom("domainSuffix", domain),
|
|
2216
2224
|
atom("ipCidr", cidr(4)),
|
|
2217
2225
|
atom("ipCidr6", cidr(6)),
|
|
2226
|
+
z.strictObject({
|
|
2227
|
+
type: z.literal("ipAsn"),
|
|
2228
|
+
value: z.number().int().min(1).max(4294967295),
|
|
2229
|
+
...options$1
|
|
2230
|
+
}),
|
|
2218
2231
|
atom("sourceIp", z.union([ip, cidr()])),
|
|
2219
2232
|
atom("processName", safe),
|
|
2220
2233
|
atom("macAddress", z.string().regex(/^(?:[\da-fA-F]{2}:){5}[\da-fA-F]{2}$/)),
|
|
@@ -2376,6 +2389,7 @@ function compileSurgeProfile(input) {
|
|
|
2376
2389
|
if (c.noResolve !== void 0 && ![
|
|
2377
2390
|
"ipCidr",
|
|
2378
2391
|
"ipCidr6",
|
|
2392
|
+
"ipAsn",
|
|
2379
2393
|
"ruleSet"
|
|
2380
2394
|
].includes(c.type)) error("RULE_OPTION_UNSUPPORTED");
|
|
2381
2395
|
if (c.includeSniffed !== void 0 && ![
|
|
@@ -2439,6 +2453,7 @@ function conditionText(c) {
|
|
|
2439
2453
|
domainSuffix: "DOMAIN-SUFFIX",
|
|
2440
2454
|
ipCidr: "IP-CIDR",
|
|
2441
2455
|
ipCidr6: "IP-CIDR6",
|
|
2456
|
+
ipAsn: "IP-ASN",
|
|
2442
2457
|
sourceIp: "SRC-IP",
|
|
2443
2458
|
processName: "PROCESS-NAME",
|
|
2444
2459
|
macAddress: "MAC-ADDRESS"
|
package/package.json
CHANGED