meta-json-schema 1.18.3-beta
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/.gitattributes +2 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +18 -0
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/package.json +40 -0
- package/schemas/clash-verge-merge-json-schema.json +1 -0
- package/schemas/meta-json-schema.json +1 -0
- package/scripts/release.mjs +16 -0
- package/scripts/util/bundle.mjs +91 -0
- package/scripts/util/env.mjs +9 -0
- package/scripts/util/file.mjs +13 -0
- package/scripts/watch.mjs +28 -0
- package/src/clash-verge-merge-json-schema.json +88 -0
- package/src/definitions/compatible.json +6 -0
- package/src/definitions/enums.json +57 -0
- package/src/definitions/patterns.json +87 -0
- package/src/definitions/types.json +155 -0
- package/src/meta-json-schema.json +168 -0
- package/src/modules/adapter/outbound/base.json +91 -0
- package/src/modules/adapter/outbound/direct.json +39 -0
- package/src/modules/adapter/outbound/dns.json +39 -0
- package/src/modules/adapter/outbound/http.json +101 -0
- package/src/modules/adapter/outbound/hysteria.json +182 -0
- package/src/modules/adapter/outbound/hysteria2.json +146 -0
- package/src/modules/adapter/outbound/reality.json +25 -0
- package/src/modules/adapter/outbound/shadowsocks.json +308 -0
- package/src/modules/adapter/outbound/shadowsocksr.json +151 -0
- package/src/modules/adapter/outbound/singmux.json +95 -0
- package/src/modules/adapter/outbound/snell.json +65 -0
- package/src/modules/adapter/outbound/socks5.json +88 -0
- package/src/modules/adapter/outbound/ssh.json +87 -0
- package/src/modules/adapter/outbound/trojan.json +93 -0
- package/src/modules/adapter/outbound/tuic.json +213 -0
- package/src/modules/adapter/outbound/vless.json +146 -0
- package/src/modules/adapter/outbound/vmess.json +251 -0
- package/src/modules/adapter/outbound/wireguard.json +150 -0
- package/src/modules/adapter/outboundgroup/fallback.json +18 -0
- package/src/modules/adapter/outboundgroup/groupbase.json +98 -0
- package/src/modules/adapter/outboundgroup/loadbalance.json +29 -0
- package/src/modules/adapter/outboundgroup/relay.json +18 -0
- package/src/modules/adapter/outboundgroup/urltest.json +25 -0
- package/src/modules/adapter/provider/health-check.json +73 -0
- package/src/modules/adapter/provider/provider.json +159 -0
- package/src/modules/config/authentication.json +9 -0
- package/src/modules/config/controller.json +47 -0
- package/src/modules/config/dns.json +156 -0
- package/src/modules/config/ebpf.json +22 -0
- package/src/modules/config/experimental.json +31 -0
- package/src/modules/config/general.json +140 -0
- package/src/modules/config/geox-url.json +38 -0
- package/src/modules/config/hosts.json +9 -0
- package/src/modules/config/inbound.json +98 -0
- package/src/modules/config/iptables.json +38 -0
- package/src/modules/config/listeners.json +90 -0
- package/src/modules/config/ntp.json +50 -0
- package/src/modules/config/profile.json +24 -0
- package/src/modules/config/proxies.json +118 -0
- package/src/modules/config/proxy-groups.json +21 -0
- package/src/modules/config/proxy-providers.json +11 -0
- package/src/modules/config/rules.json +11 -0
- package/src/modules/config/sniffer.json +111 -0
- package/src/modules/config/sub-rules.json +14 -0
- package/src/modules/config/tls.json +28 -0
- package/src/modules/config/tunnels.json +49 -0
- package/src/modules/listener/config/tuic.json +102 -0
- package/src/modules/listener/config/tun.json +205 -0
- package/src/modules/listener/inbound/base.json +43 -0
- package/src/modules/listener/inbound/http.json +18 -0
- package/src/modules/listener/inbound/hysteria2.json +102 -0
- package/src/modules/listener/inbound/mixed.json +26 -0
- package/src/modules/listener/inbound/mux.json +42 -0
- package/src/modules/listener/inbound/redir.json +18 -0
- package/src/modules/listener/inbound/shadowsocks.json +41 -0
- package/src/modules/listener/inbound/socks.json +26 -0
- package/src/modules/listener/inbound/tproxy.json +26 -0
- package/src/modules/listener/inbound/tuic.json +84 -0
- package/src/modules/listener/inbound/tun.json +207 -0
- package/src/modules/listener/inbound/tunnel.json +33 -0
- package/src/modules/listener/inbound/vmess.json +72 -0
- package/src/modules/listener/sing/sing.json +42 -0
- package/src/modules/rules/provider/provider.json +71 -0
- package/src/modules/rules/rule.json +165 -0
- package/test/clash-meta/example1.yaml +3170 -0
- package/test/clash-verge/merge.yaml +212 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import bundle from './util/bundle.mjs';
|
|
2
|
+
import { pkg, resolve } from './util/env.mjs';
|
|
3
|
+
|
|
4
|
+
(async () => {
|
|
5
|
+
// 读取release配置
|
|
6
|
+
const releases = pkg.config.releases;
|
|
7
|
+
for (let release of releases) {
|
|
8
|
+
if (release.enabled) {
|
|
9
|
+
const source = resolve(release.source);
|
|
10
|
+
const target = resolve(release.target);
|
|
11
|
+
const optimization = release.optimization;
|
|
12
|
+
// 执行bundle
|
|
13
|
+
await bundle(source, target, optimization, true);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})();
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
2
|
+
import prettier from 'prettier';
|
|
3
|
+
import { writeToFileSync } from './file.mjs';
|
|
4
|
+
|
|
5
|
+
const print = (message, verbose) => {
|
|
6
|
+
if (verbose) console.log(message);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// 处理间接引用(引用的内容是另一个内容的引用)
|
|
10
|
+
// 间接引用虽然语法正确,但可能会无法被某些解析器正确解析
|
|
11
|
+
const handleIndirectReference = async jsonObject => {
|
|
12
|
+
// 先进行格式化,防止出错
|
|
13
|
+
let formatted = await format(JSON.stringify(jsonObject));
|
|
14
|
+
// 获取所有引用
|
|
15
|
+
let references = allReferences(formatted);
|
|
16
|
+
// 找出间接引用
|
|
17
|
+
let indirectReferences;
|
|
18
|
+
while ((indirectReferences = references.map(ref => indirectReference(jsonObject, ref)).filter(Boolean)).length > 0) {
|
|
19
|
+
// 替换间接引用为目标引用
|
|
20
|
+
indirectReferences.forEach(reference => {
|
|
21
|
+
formatted = formatted.replaceAll(reference.path, reference.target);
|
|
22
|
+
jsonObject = JSON.parse(formatted);
|
|
23
|
+
references = allReferences(formatted);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return formatted;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 获取所有引用
|
|
30
|
+
const allReferences = formatted => {
|
|
31
|
+
let references = [];
|
|
32
|
+
const regex = /"\$ref": "(.*)"/gm;
|
|
33
|
+
let matcher;
|
|
34
|
+
while ((matcher = regex.exec(formatted)) !== null) {
|
|
35
|
+
regex.lastIndex += matcher.index === regex.lastIndex ? 1 : 0;
|
|
36
|
+
references.push(matcher[1]);
|
|
37
|
+
}
|
|
38
|
+
return [...new Set(references)];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// 获取间接引用
|
|
42
|
+
const indirectReference = (jsonObject, ref) => {
|
|
43
|
+
const nodes = ref?.replace('#/', '')?.split('/');
|
|
44
|
+
let path = '#';
|
|
45
|
+
let current = jsonObject;
|
|
46
|
+
let next;
|
|
47
|
+
if (nodes.length > 0) {
|
|
48
|
+
for (let node of nodes) {
|
|
49
|
+
if (!(next = current[node])) break;
|
|
50
|
+
path = `${path}/${node}`;
|
|
51
|
+
current = next;
|
|
52
|
+
if (typeof next === 'object' && next['$ref'] && Object.keys(next).length === 1) {
|
|
53
|
+
return {
|
|
54
|
+
path: path,
|
|
55
|
+
target: next['$ref']
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const format = async json => {
|
|
63
|
+
// 格式化json内容
|
|
64
|
+
const options = {
|
|
65
|
+
parser: 'json',
|
|
66
|
+
quoteProps: 'as-needed', // 添加引号包裹
|
|
67
|
+
singleQuote: false, //使用单引号
|
|
68
|
+
trailingComma: 'all', // 添加尾随逗号
|
|
69
|
+
bracketSpacing: false, // 添加对象{}之间空格
|
|
70
|
+
proseWrap: 'preserve', // 换行行为
|
|
71
|
+
endOfLine: 'lf', // 换行符
|
|
72
|
+
embeddedLanguageFormatting: 'auto' // 格式化内容中的代码
|
|
73
|
+
};
|
|
74
|
+
return await prettier.format(json, options).then(formatted => formatted);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default async function (input, output, optimization, verbose) {
|
|
78
|
+
// bundle文件片段
|
|
79
|
+
print(`📦 Bundling...(${input})`, verbose);
|
|
80
|
+
await $RefParser.bundle(input).then(async jsonObject => {
|
|
81
|
+
// 间接引用解引用,提高兼容性()
|
|
82
|
+
let dereferred = await handleIndirectReference(jsonObject);
|
|
83
|
+
|
|
84
|
+
// 格式化 / 最小化(约缩减40%)
|
|
85
|
+
const schema = optimization ? JSON.stringify(JSON.parse(dereferred)) : (dereferred = await format(dereferred));
|
|
86
|
+
|
|
87
|
+
// 输出内容
|
|
88
|
+
writeToFileSync(output, schema, true);
|
|
89
|
+
print(`💾 Saving to: ${output}`, verbose);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
// package.json对象
|
|
5
|
+
export const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
6
|
+
|
|
7
|
+
// resolve路径
|
|
8
|
+
const workspace = path.dirname(path.resolve('package.json'));
|
|
9
|
+
export const resolve = (...args) => path.resolve(workspace, ...args);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export const writeToFileSync = (file, data, clean = true) => {
|
|
5
|
+
if (fs.existsSync(file) && clean) {
|
|
6
|
+
fs.rmSync(file);
|
|
7
|
+
}
|
|
8
|
+
const directory = path.dirname(file);
|
|
9
|
+
if (!fs.existsSync(directory)) {
|
|
10
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
11
|
+
}
|
|
12
|
+
fs.writeFileSync(file, data);
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import bundle from './util/bundle.mjs';
|
|
4
|
+
import { pkg, resolve } from './util/env.mjs';
|
|
5
|
+
|
|
6
|
+
const watchPath = resolve('./src');
|
|
7
|
+
(async () => {
|
|
8
|
+
console.log(`♻️ Watching for: ${watchPath} ...`);
|
|
9
|
+
|
|
10
|
+
for (let source of pkg.config.watches) {
|
|
11
|
+
const target = resolve(`./.temp/${source.substr(source.lastIndexOf('/') + 1)}`);
|
|
12
|
+
|
|
13
|
+
// 监测目录及子目录的文件变动
|
|
14
|
+
fs.watch(watchPath, { recursive: true }, async (_type, filename) => {
|
|
15
|
+
const file = path.resolve(watchPath, filename);
|
|
16
|
+
if (fs.existsSync(file)) {
|
|
17
|
+
try {
|
|
18
|
+
console.log(`Changes in: ${file}`);
|
|
19
|
+
|
|
20
|
+
// 执行bundle
|
|
21
|
+
await bundle(source, target, false, false);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error(`Error watching: ${file}: `, error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://github.com/clash-verge-rev/clash-verge-rev/schemas/meta-json-schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"title": "Clash Verge Merge",
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"definitions": {
|
|
8
|
+
"meta-json-schema": { "$ref": "./meta-json-schema.json" },
|
|
9
|
+
"proxies": { "$ref": "./modules/config/proxies.json" },
|
|
10
|
+
"proxy-providers": { "$ref": "./modules/config/proxy-providers.json" },
|
|
11
|
+
"proxy-groups": { "$ref": "./modules/config/proxy-groups.json" },
|
|
12
|
+
"rule-providers": { "$ref": "./modules/rules/provider/provider.json" },
|
|
13
|
+
"rules": { "$ref": "./modules/config/rules.json" }
|
|
14
|
+
},
|
|
15
|
+
"allOf": [
|
|
16
|
+
{ "title": "覆写profile配置", "$ref": "#/definitions/meta-json-schema" },
|
|
17
|
+
{
|
|
18
|
+
"type": "object",
|
|
19
|
+
"title": "前置规则配置",
|
|
20
|
+
"properties": {
|
|
21
|
+
"prepend-rules": { "title": "前置规则配置", "$ref": "#/definitions/rules" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "object",
|
|
26
|
+
"title": "前置规则集合配置",
|
|
27
|
+
"properties": {
|
|
28
|
+
"prepend-rule-providers": { "title": "前置规则集合配置", "$ref": "#/definitions/rule-providers" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"title": "前置代理节点配置",
|
|
34
|
+
"properties": {
|
|
35
|
+
"prepend-proxies": { "title": "prepend-proxies", "$ref": "#/definitions/proxies" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "object",
|
|
40
|
+
"title": "前置代理集合配置",
|
|
41
|
+
"properties": {
|
|
42
|
+
"prepend-proxy-providers": { "title": "前置代理集合配置", "$ref": "#/definitions/proxy-providers" }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "object",
|
|
47
|
+
"title": "前置代理组配置",
|
|
48
|
+
"properties": {
|
|
49
|
+
"prepend-proxy-groups": { "title": "前置代理组配置", "$ref": "#/definitions/proxy-groups" }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "object",
|
|
54
|
+
"title": "后置规则配置",
|
|
55
|
+
"properties": {
|
|
56
|
+
"append-rules": { "title": "后置规则配置", "$ref": "#/definitions/rules" }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "object",
|
|
61
|
+
"title": "后置规则集合配置",
|
|
62
|
+
"properties": {
|
|
63
|
+
"append-rule-providers": { "title": "后置规则集合配置", "$ref": "#/definitions/rule-providers" }
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"title": "后置代理节点配置",
|
|
69
|
+
"properties": {
|
|
70
|
+
"append-proxies": { "title": "后置代理节点配置", "$ref": "#/definitions/proxies" }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "object",
|
|
75
|
+
"title": "后置代理集合配置",
|
|
76
|
+
"properties": {
|
|
77
|
+
"append-proxy-providers": { "title": "后置代理集合配置", "$ref": "#/definitions/proxy-providers" }
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "object",
|
|
82
|
+
"title": "后置代理组配置",
|
|
83
|
+
"properties": {
|
|
84
|
+
"append-proxy-groups": { "title": "后置代理组配置", "$ref": "#/definitions/proxy-groups" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"string": { "anyOf": [{ "type": "string" }, { "pattern": "^\\d+(\\.\\d+)?$" }] },
|
|
3
|
+
"integer": { "anyOf": [{ "type": "integer" }, { "pattern": "^\\d+$" }] },
|
|
4
|
+
"number": { "anyOf": [{ "type": "number" }, { "pattern": "^\\d+(\\.\\d+)?$" }] },
|
|
5
|
+
"boolean": { "anyOf": [{ "type": "boolean" }, { "pattern": "^(?i)(true|false)$" }] }
|
|
6
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cipher": {
|
|
3
|
+
"description": "加密方法",
|
|
4
|
+
"enum": [
|
|
5
|
+
"auto",
|
|
6
|
+
"dummy",
|
|
7
|
+
"aes-128-gcm",
|
|
8
|
+
"aes-192-gcm",
|
|
9
|
+
"aes-256-gcm",
|
|
10
|
+
"lea-128-gcm",
|
|
11
|
+
"lea-192-gcm",
|
|
12
|
+
"lea-256-gcm",
|
|
13
|
+
"aes-128-gcm-siv",
|
|
14
|
+
"aes-256-gcm-siv",
|
|
15
|
+
"2022-blake3-aes-128-gcm",
|
|
16
|
+
"2022-blake3-aes-256-gcm",
|
|
17
|
+
"aes-128-cfb",
|
|
18
|
+
"aes-192-cfb",
|
|
19
|
+
"aes-256-cfb",
|
|
20
|
+
"aes-128-ctr",
|
|
21
|
+
"aes-192-ctr",
|
|
22
|
+
"aes-256-ctr",
|
|
23
|
+
"chacha20",
|
|
24
|
+
"chacha20-ietf",
|
|
25
|
+
"chacha20-ietf-poly1305",
|
|
26
|
+
"2022-blake3-chacha20-poly1305",
|
|
27
|
+
"rabbit128-poly1305",
|
|
28
|
+
"xchacha20-ietf-poly1305",
|
|
29
|
+
"xchacha20",
|
|
30
|
+
"aegis-128l",
|
|
31
|
+
"aegis-256",
|
|
32
|
+
"aez-384",
|
|
33
|
+
"deoxys-ii-256-128",
|
|
34
|
+
"rc4-md5"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"fingerprint": {
|
|
38
|
+
"description": "指纹",
|
|
39
|
+
"enum": [
|
|
40
|
+
"chrome",
|
|
41
|
+
"chrome_psk",
|
|
42
|
+
"chrome_psk_shuffle",
|
|
43
|
+
"chrome_padding_psk_shuffle",
|
|
44
|
+
"chrome_pq",
|
|
45
|
+
"chrome_pq_psk",
|
|
46
|
+
"firefox",
|
|
47
|
+
"safari",
|
|
48
|
+
"ios",
|
|
49
|
+
"android",
|
|
50
|
+
"edge",
|
|
51
|
+
"360",
|
|
52
|
+
"qq",
|
|
53
|
+
"random",
|
|
54
|
+
"randomized"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"port": {
|
|
3
|
+
"anyOf": [
|
|
4
|
+
{ "type": "integer", "minimum": 0, "maximum": 65535 },
|
|
5
|
+
{
|
|
6
|
+
"type": "string",
|
|
7
|
+
"pattern": "^(?:[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$",
|
|
8
|
+
"errorMessage": "无效的端口号(0~65535)"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"portRange": {
|
|
13
|
+
"pattern": "^(?:[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^([1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])-(?:[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$",
|
|
14
|
+
"errorMessage": "无效的端口范围(port 或 port1-port2)"
|
|
15
|
+
},
|
|
16
|
+
"ipv4": {
|
|
17
|
+
"pattern": "^(?:(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$",
|
|
18
|
+
"errorMessage": "无效的IPv4地址"
|
|
19
|
+
},
|
|
20
|
+
"ipv4Port": {
|
|
21
|
+
"pattern": "^(?:(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5])):(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-5]{2}[0-3][0-5])$",
|
|
22
|
+
"errorMessage": "无效的IPv4地址:端口"
|
|
23
|
+
},
|
|
24
|
+
"ipv4CIDR": {
|
|
25
|
+
"pattern": "^(?:(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[1-9]?[0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))(?:\\/(?:[12]?[0-9]|3[0-2]))$",
|
|
26
|
+
"errorMessage": "无效的IPv4网段"
|
|
27
|
+
},
|
|
28
|
+
"ipv6": {
|
|
29
|
+
"pattern": "^([0-9a-fA-F]{1,4}(?::[0-9a-fA-F]{1,4}){7}|::|:(?::[0-9a-fA-F]{1,4}){1,6}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,5}|(?:[0-9a-fA-F]{1,4}:){2}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){3}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){4}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){5}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,6}:)$",
|
|
30
|
+
"errorMessage": "无效的IPv6地址"
|
|
31
|
+
},
|
|
32
|
+
"ipv6Port": {
|
|
33
|
+
"pattern": "^\\[([0-9a-fA-F]{1,4}(?::[0-9a-fA-F]{1,4}){7}|::|:(?::[0-9a-fA-F]{1,4}){1,6}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,5}|(?:[0-9a-fA-F]{1,4}:){2}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){3}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){4}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){5}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,6}:)\\]:(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-5]{2}[0-3][0-5])$",
|
|
34
|
+
"errorMessage": "无效的[IPv6地址]:端口"
|
|
35
|
+
},
|
|
36
|
+
"ipv6CIDR": {
|
|
37
|
+
"pattern": "^([0-9a-fA-F]{1,4}(?::[0-9a-fA-F]{1,4}){7}|::|:(?::[0-9a-fA-F]{1,4}){1,6}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,5}|(?:[0-9a-fA-F]{1,4}:){2}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){3}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){4}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){5}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,6}:)\\/(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$",
|
|
38
|
+
"errorMessage": "无效的IPv6网段"
|
|
39
|
+
},
|
|
40
|
+
"ip": {
|
|
41
|
+
"anyOf": [
|
|
42
|
+
{ "description": "ipv4", "$ref": "#/ipv4" },
|
|
43
|
+
{ "description": "ipv6", "$ref": "#/ipv6" }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"ipPort": {
|
|
47
|
+
"anyOf": [
|
|
48
|
+
{ "description": "ipv4:端口", "$ref": "#/ipv4Port" },
|
|
49
|
+
{ "description": "[ipv6]:端口", "$ref": "#/ipv6Port" }
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"ipCIDR": {
|
|
53
|
+
"anyOf": [
|
|
54
|
+
{ "description": "ipv4网段", "$ref": "#/ipv4CIDR" },
|
|
55
|
+
{ "description": "ipv6网段", "$ref": "#/ipv6CIDR" }
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"domain": {
|
|
59
|
+
"pattern": "^(xn--)?[a-zA-Z0-9-_]+(?:\\.(xn--)?[a-zA-Z0-9-_]+)+$",
|
|
60
|
+
"errorMessage": "无效的域名"
|
|
61
|
+
},
|
|
62
|
+
"domainWildcard": {
|
|
63
|
+
"pattern": "^[\\.\\+]?(xn--)?[a-zA-Z0-9-_*]+(?:\\.(xn--)?[a-zA-Z0-9-_*]+)+$",
|
|
64
|
+
"errorMessage": "无效的域名通配"
|
|
65
|
+
},
|
|
66
|
+
"server": {
|
|
67
|
+
"anyOf": [
|
|
68
|
+
{ "description": "ipv4", "$ref": "#/ipv4" },
|
|
69
|
+
{ "description": "ipv4:端口", "$ref": "#/ipv4Port" },
|
|
70
|
+
{ "description": "ipv6", "$ref": "#/ipv6" },
|
|
71
|
+
{ "description": "[ipv6]:端口", "$ref": "#/ipv6Port" },
|
|
72
|
+
{ "description": "域名", "$ref": "#/domain" }
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"url": {
|
|
76
|
+
"pattern": "^.+:\\/\\/([^\\s/$.?#].[^\\s]*)\\.[^\\s]{2,}(\\/[^\\s]*)?$",
|
|
77
|
+
"errorMessage": "无效的URL"
|
|
78
|
+
},
|
|
79
|
+
"httpUrl": {
|
|
80
|
+
"pattern": "^https?:\\/\\/([^\\s/$.?#].[^\\s]*)\\.[^\\s]{2,}(\\/[^\\s]*)?$",
|
|
81
|
+
"errorMessage": "无效的HTTP-URL"
|
|
82
|
+
},
|
|
83
|
+
"uuid": {
|
|
84
|
+
"pattern": "^[0-9a-fA-F]{8}(?:-?[0-9a-fA-F]{4}){3}-?[0-9a-fA-F]{12}$",
|
|
85
|
+
"errorMessage": "无效的UUID"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"stringArray": {
|
|
3
|
+
"anyOf": [
|
|
4
|
+
{
|
|
5
|
+
"type": "array",
|
|
6
|
+
"items": { "$ref": "compatible.json#/string" }
|
|
7
|
+
},
|
|
8
|
+
{ "$ref": "compatible.json#/string" }
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"portArray": {
|
|
12
|
+
"anyOf": [
|
|
13
|
+
{
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "$ref": "patterns.json#/port" }
|
|
16
|
+
},
|
|
17
|
+
{ "$ref": "patterns.json#/port" }
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"portRangeArray": {
|
|
21
|
+
"anyOf": [
|
|
22
|
+
{
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": { "$ref": "patterns.json#/portRange" }
|
|
25
|
+
},
|
|
26
|
+
{ "$ref": "patterns.json#/portRange" }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"ipv4Array": {
|
|
30
|
+
"anyOf": [
|
|
31
|
+
{
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": { "$ref": "patterns.json#/ipv4" }
|
|
34
|
+
},
|
|
35
|
+
{ "$ref": "patterns.json#/ipv4" }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"ipv4PortArray": {
|
|
39
|
+
"anyOf": [
|
|
40
|
+
{
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": { "$ref": "patterns.json#/ipv4Port" }
|
|
43
|
+
},
|
|
44
|
+
{ "$ref": "patterns.json#/ipv4Port" }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"ipv4CIDRArray": {
|
|
48
|
+
"anyOf": [
|
|
49
|
+
{
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": { "$ref": "patterns.json#/ipv4CIDR" }
|
|
52
|
+
},
|
|
53
|
+
{ "$ref": "patterns.json#/ipv4CIDR" }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"ipv6Array": {
|
|
57
|
+
"anyOf": [
|
|
58
|
+
{
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": { "$ref": "patterns.json#/ipv6" }
|
|
61
|
+
},
|
|
62
|
+
{ "$ref": "patterns.json#/ipv6" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"ipv6PortArray": {
|
|
66
|
+
"anyOf": [
|
|
67
|
+
{
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": { "$ref": "patterns.json#/ipv6Port" }
|
|
70
|
+
},
|
|
71
|
+
{ "$ref": "patterns.json#/ipv6Port" }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"ipv6CIDRArray": {
|
|
75
|
+
"anyOf": [
|
|
76
|
+
{
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": { "$ref": "patterns.json#/ipv6CIDR" }
|
|
79
|
+
},
|
|
80
|
+
{ "$ref": "patterns.json#/ipv6CIDR" }
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"ipArray": {
|
|
84
|
+
"anyOf": [
|
|
85
|
+
{
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": { "$ref": "patterns.json#/ip" }
|
|
88
|
+
},
|
|
89
|
+
{ "$ref": "patterns.json#/ip" }
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"ipPortArray": {
|
|
93
|
+
"anyOf": [
|
|
94
|
+
{
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": { "$ref": "patterns.json#/ipPort" }
|
|
97
|
+
},
|
|
98
|
+
{ "$ref": "patterns.json#/ipPort" }
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"ipCIDRArray": {
|
|
102
|
+
"anyOf": [
|
|
103
|
+
{
|
|
104
|
+
"type": "array",
|
|
105
|
+
"items": { "$ref": "patterns.json#/ipCIDR" }
|
|
106
|
+
},
|
|
107
|
+
{ "$ref": "patterns.json#/ipCIDR" }
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"serverArray": {
|
|
111
|
+
"anyOf": [
|
|
112
|
+
{
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": { "$ref": "patterns.json#/server" }
|
|
115
|
+
},
|
|
116
|
+
{ "$ref": "patterns.json#/server" }
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"domainArray": {
|
|
120
|
+
"anyOf": [
|
|
121
|
+
{
|
|
122
|
+
"type": "array",
|
|
123
|
+
"items": { "$ref": "patterns.json#/domain" }
|
|
124
|
+
},
|
|
125
|
+
{ "$ref": "patterns.json#/domain" }
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"domainWildcardArray": {
|
|
129
|
+
"anyOf": [
|
|
130
|
+
{
|
|
131
|
+
"type": "array",
|
|
132
|
+
"items": { "$ref": "patterns.json#/domainWildcard" }
|
|
133
|
+
},
|
|
134
|
+
{ "$ref": "patterns.json#/domainWildcard" }
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"urlArray": {
|
|
138
|
+
"anyOf": [
|
|
139
|
+
{
|
|
140
|
+
"type": "array",
|
|
141
|
+
"items": { "$ref": "patterns.json#/url" }
|
|
142
|
+
},
|
|
143
|
+
{ "$ref": "patterns.json#/url" }
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"httpUrlArray": {
|
|
147
|
+
"anyOf": [
|
|
148
|
+
{
|
|
149
|
+
"type": "array",
|
|
150
|
+
"items": { "$ref": "patterns.json#/httpUrl" }
|
|
151
|
+
},
|
|
152
|
+
{ "$ref": "patterns.json#/httpUrl" }
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|