proxylang 0.4.0 → 0.5.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/dist/cli.js +1 -1
- package/dist/index.d.ts +173 -24
- package/dist/index.js +2 -2
- package/dist/{profile-build-DYCbePBx.js → profile-build-Cokl8MBF.js} +784 -691
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { K as requestSchema, L as targetCatalog, M as compile, N as explain, V as StaticRuleSetUnknownError, i as buildToDirectory, n as profileBuildFailure, r as runBuild } from "./profile-build-Cokl8MBF.js";
|
|
3
3
|
import { open } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export type NativeRuleSet = {
|
|
|
14
14
|
readonly engine: "surge";
|
|
15
15
|
readonly format: "rule-set" | "domain-set";
|
|
16
16
|
readonly intervalSeconds?: number;
|
|
17
|
+
readonly noResolve?: boolean;
|
|
18
|
+
readonly extendedMatching?: boolean;
|
|
17
19
|
} | {
|
|
18
20
|
readonly engine: "sing-box";
|
|
19
21
|
readonly format: "source" | "binary";
|
|
@@ -25,7 +27,15 @@ export type NativeRuleSet = {
|
|
|
25
27
|
readonly intervalSeconds: number;
|
|
26
28
|
});
|
|
27
29
|
export type Match = NamedRuleSet | NativeRuleSet | {
|
|
28
|
-
readonly type: "domain" | "domainSuffix"
|
|
30
|
+
readonly type: "domain" | "domainSuffix";
|
|
31
|
+
readonly extendedMatching?: boolean;
|
|
32
|
+
readonly value: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "ipCidr";
|
|
35
|
+
readonly value: string;
|
|
36
|
+
readonly noResolve?: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "sourceIp" | "processName";
|
|
29
39
|
readonly value: string;
|
|
30
40
|
} | {
|
|
31
41
|
readonly type: "port" | "sourcePort";
|
|
@@ -253,6 +263,8 @@ export type Target = {
|
|
|
253
263
|
export type Request = {
|
|
254
264
|
readonly network: Network;
|
|
255
265
|
readonly domain?: string;
|
|
266
|
+
readonly tlsSni?: string;
|
|
267
|
+
readonly httpHost?: string;
|
|
256
268
|
readonly ip?: string;
|
|
257
269
|
readonly sourceIp?: string;
|
|
258
270
|
readonly processName?: string;
|
|
@@ -453,6 +465,7 @@ type SurgeCondition = ConditionOptions & ({
|
|
|
453
465
|
readonly format: "rule-set" | "domain-set";
|
|
454
466
|
readonly url?: string;
|
|
455
467
|
readonly builtin?: "LAN" | "SYSTEM";
|
|
468
|
+
readonly intervalSeconds?: number;
|
|
456
469
|
});
|
|
457
470
|
type SurgeRule = {
|
|
458
471
|
readonly when: SurgeCondition;
|
|
@@ -724,19 +737,72 @@ declare function proxyBuilder<N extends ProxyNode>(node: N): ProxyBuilder<Extrac
|
|
|
724
737
|
//#endregion
|
|
725
738
|
//#region src/dsl.d.ts
|
|
726
739
|
export declare const ruleSet: (definition: Omit<NamedRuleSet, "type">) => NamedRuleSet;
|
|
740
|
+
type DomainOptions = {
|
|
741
|
+
readonly extendedMatching?: boolean;
|
|
742
|
+
};
|
|
743
|
+
type IpOptions = {
|
|
744
|
+
readonly noResolve?: boolean;
|
|
745
|
+
};
|
|
727
746
|
export declare const match: {
|
|
728
|
-
processName: (value: string) =>
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
747
|
+
processName: (value: string) => {
|
|
748
|
+
readonly type: "processName";
|
|
749
|
+
readonly value: string;
|
|
750
|
+
};
|
|
751
|
+
ruleSet: (set: NamedRuleSet) => NamedRuleSet;
|
|
752
|
+
domain: (value: string, opts?: DomainOptions) => {
|
|
753
|
+
extendedMatching?: boolean;
|
|
754
|
+
type: "domain";
|
|
755
|
+
value: string;
|
|
756
|
+
};
|
|
757
|
+
domainSuffix: (value: string, opts?: DomainOptions) => {
|
|
758
|
+
extendedMatching?: boolean;
|
|
759
|
+
type: "domainSuffix";
|
|
760
|
+
value: string;
|
|
761
|
+
};
|
|
762
|
+
ipCidr: (value: string, opts?: IpOptions) => {
|
|
763
|
+
noResolve?: boolean;
|
|
764
|
+
type: "ipCidr";
|
|
765
|
+
value: string;
|
|
766
|
+
};
|
|
767
|
+
sourceIp: (value: string) => {
|
|
768
|
+
type: "sourceIp";
|
|
769
|
+
value: string;
|
|
770
|
+
};
|
|
771
|
+
port: (from: number, to?: number) => {
|
|
772
|
+
type: "port";
|
|
773
|
+
from: number;
|
|
774
|
+
to: number;
|
|
775
|
+
};
|
|
776
|
+
sourcePort: (from: number, to?: number) => {
|
|
777
|
+
type: "sourcePort";
|
|
778
|
+
from: number;
|
|
779
|
+
to: number;
|
|
780
|
+
};
|
|
781
|
+
network: (value: Network) => {
|
|
782
|
+
type: "network";
|
|
783
|
+
value: Network;
|
|
784
|
+
};
|
|
785
|
+
all: <const C extends readonly ProfileCondition[]>(...conditions: C) => {
|
|
786
|
+
type: "all";
|
|
787
|
+
conditions: C;
|
|
788
|
+
};
|
|
789
|
+
any: <const C extends readonly ProfileCondition[]>(...conditions: C) => {
|
|
790
|
+
type: "any";
|
|
791
|
+
conditions: C;
|
|
792
|
+
};
|
|
793
|
+
not: <const C extends ProfileCondition>(condition: C) => {
|
|
794
|
+
type: "not";
|
|
795
|
+
condition: C;
|
|
796
|
+
};
|
|
797
|
+
};
|
|
798
|
+
type NativeFor<E extends NativeRuleSet["engine"]> = Extract<NativeRuleSet, {
|
|
799
|
+
engine: E;
|
|
800
|
+
}>;
|
|
801
|
+
type NativeInput<E extends NativeRuleSet["engine"]> = Omit<NativeFor<E>, "type" | "engine" | "id"> & {
|
|
802
|
+
readonly id?: string;
|
|
803
|
+
};
|
|
804
|
+
type SurgeSetInput = Omit<NativeInput<"surge">, "format"> & {
|
|
805
|
+
readonly format?: "rule-set" | "domain-set";
|
|
740
806
|
};
|
|
741
807
|
export declare const direct: () => Action;
|
|
742
808
|
export declare const reject: () => Action;
|
|
@@ -846,16 +912,78 @@ export declare const surge: {
|
|
|
846
912
|
smart: () => Extract<GroupAlgorithm, {
|
|
847
913
|
type: "surge-smart";
|
|
848
914
|
}>;
|
|
849
|
-
ruleSet:
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
915
|
+
ruleSet: {
|
|
916
|
+
(input: Omit<NativeInput<"surge">, "format"> & {
|
|
917
|
+
readonly format?: "rule-set" | "domain-set";
|
|
918
|
+
} & {
|
|
919
|
+
readonly to: ProfileDestination;
|
|
920
|
+
}): RouteDefinition;
|
|
921
|
+
(input: SurgeSetInput): {
|
|
922
|
+
readonly type: "nativeRuleSet";
|
|
923
|
+
readonly id: string;
|
|
924
|
+
readonly url: string;
|
|
925
|
+
} & {
|
|
926
|
+
readonly engine: "surge";
|
|
927
|
+
readonly format: "rule-set" | "domain-set";
|
|
928
|
+
readonly intervalSeconds?: number;
|
|
929
|
+
readonly noResolve?: boolean;
|
|
930
|
+
readonly extendedMatching?: boolean;
|
|
931
|
+
};
|
|
932
|
+
};
|
|
854
933
|
};
|
|
855
934
|
export declare const mihomo: {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
935
|
+
ruleSet: {
|
|
936
|
+
(input: Omit<{
|
|
937
|
+
readonly type: "nativeRuleSet";
|
|
938
|
+
readonly id: string;
|
|
939
|
+
readonly url: string;
|
|
940
|
+
} & {
|
|
941
|
+
readonly engine: "mihomo";
|
|
942
|
+
readonly format: "yaml" | "text";
|
|
943
|
+
readonly behavior: "domain" | "ipcidr" | "classical";
|
|
944
|
+
readonly intervalSeconds: number;
|
|
945
|
+
}, "engine" | "id" | "type"> & {
|
|
946
|
+
readonly id?: string;
|
|
947
|
+
} & {
|
|
948
|
+
readonly to: ProfileDestination;
|
|
949
|
+
}): RouteDefinition;
|
|
950
|
+
(input: NativeInput<"mihomo">): {
|
|
951
|
+
readonly type: "nativeRuleSet";
|
|
952
|
+
readonly id: string;
|
|
953
|
+
readonly url: string;
|
|
954
|
+
} & {
|
|
955
|
+
readonly engine: "mihomo";
|
|
956
|
+
readonly format: "yaml" | "text";
|
|
957
|
+
readonly behavior: "domain" | "ipcidr" | "classical";
|
|
958
|
+
readonly intervalSeconds: number;
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
ruleProvider: {
|
|
962
|
+
(input: Omit<{
|
|
963
|
+
readonly type: "nativeRuleSet";
|
|
964
|
+
readonly id: string;
|
|
965
|
+
readonly url: string;
|
|
966
|
+
} & {
|
|
967
|
+
readonly engine: "mihomo";
|
|
968
|
+
readonly format: "yaml" | "text";
|
|
969
|
+
readonly behavior: "domain" | "ipcidr" | "classical";
|
|
970
|
+
readonly intervalSeconds: number;
|
|
971
|
+
}, "engine" | "id" | "type"> & {
|
|
972
|
+
readonly id?: string;
|
|
973
|
+
} & {
|
|
974
|
+
readonly to: ProfileDestination;
|
|
975
|
+
}): RouteDefinition;
|
|
976
|
+
(input: NativeInput<"mihomo">): {
|
|
977
|
+
readonly type: "nativeRuleSet";
|
|
978
|
+
readonly id: string;
|
|
979
|
+
readonly url: string;
|
|
980
|
+
} & {
|
|
981
|
+
readonly engine: "mihomo";
|
|
982
|
+
readonly format: "yaml" | "text";
|
|
983
|
+
readonly behavior: "domain" | "ipcidr" | "classical";
|
|
984
|
+
readonly intervalSeconds: number;
|
|
985
|
+
};
|
|
986
|
+
};
|
|
859
987
|
};
|
|
860
988
|
export declare const proxy: {
|
|
861
989
|
builder: typeof proxyBuilder;
|
|
@@ -867,9 +995,30 @@ export declare const proxy: {
|
|
|
867
995
|
vless: (options: Omit<VLESSNode, "type">) => VLESSNode;
|
|
868
996
|
};
|
|
869
997
|
export declare const singbox: {
|
|
870
|
-
ruleSet:
|
|
871
|
-
|
|
872
|
-
|
|
998
|
+
ruleSet: {
|
|
999
|
+
(input: Omit<{
|
|
1000
|
+
readonly type: "nativeRuleSet";
|
|
1001
|
+
readonly id: string;
|
|
1002
|
+
readonly url: string;
|
|
1003
|
+
} & {
|
|
1004
|
+
readonly engine: "sing-box";
|
|
1005
|
+
readonly format: "source" | "binary";
|
|
1006
|
+
readonly intervalSeconds: number;
|
|
1007
|
+
}, "engine" | "id" | "type"> & {
|
|
1008
|
+
readonly id?: string;
|
|
1009
|
+
} & {
|
|
1010
|
+
readonly to: ProfileDestination;
|
|
1011
|
+
}): RouteDefinition;
|
|
1012
|
+
(input: NativeInput<"sing-box">): {
|
|
1013
|
+
readonly type: "nativeRuleSet";
|
|
1014
|
+
readonly id: string;
|
|
1015
|
+
readonly url: string;
|
|
1016
|
+
} & {
|
|
1017
|
+
readonly engine: "sing-box";
|
|
1018
|
+
readonly format: "source" | "binary";
|
|
1019
|
+
readonly intervalSeconds: number;
|
|
1020
|
+
};
|
|
1021
|
+
};
|
|
873
1022
|
tailscale: (options: Omit<TailscaleEndpoint, "type">) => TailscaleEndpoint;
|
|
874
1023
|
};
|
|
875
1024
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { z } from "zod";
|
|
1
|
+
import { 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 selectProxies, R as RenderError, S as slot, T as use, U as deepFreeze, V as StaticRuleSetUnknownError, W as idSchema, X as defineRoutes, Y as defineRoute, Z as outbound, _ as ruleSet, a as render, b as sequence, c as direct, d as mihomo, f as policy, g as rule, h as route, i as buildToDirectory, j as secretReader, k as renderSurgeProfile, l as group, m as reject, o as block, p as proxy, q as ProfileDefinitionError, r as runBuild, s as defineConfig, t as defineBuild, u as match, v as secret, w as surge, x as singbox, y as selectNodes, z as surgeProxy } from "./profile-build-Cokl8MBF.js";
|
|
3
2
|
import { createHash } from "node:crypto";
|
|
3
|
+
import { z } from "zod";
|
|
4
4
|
//#region src/proxy-fragments.ts
|
|
5
5
|
const inputSchema = z.strictObject({
|
|
6
6
|
target: z.strictObject({
|