From df1ec15fbf298067645c2c20794e9406954102cd Mon Sep 17 00:00:00 2001
From: Asutorufa <16442314+Asutorufa@users.noreply.github.com>
Date: Tue, 28 Jan 2025 19:39:41 +0800
Subject: [PATCH] add advanced config
---
app/docs/config/page.tsx | 26 +++++++++++++++++++++-
app/docs/pbes/config/config_pb.ts | 37 ++++++++++++++++++++++++++-----
package-lock.json | 24 ++++++++++----------
package.json | 4 ++--
4 files changed, 71 insertions(+), 20 deletions(-)
diff --git a/app/docs/config/page.tsx b/app/docs/config/page.tsx
index 9c444d1..13203f2 100644
--- a/app/docs/config/page.tsx
+++ b/app/docs/config/page.tsx
@@ -8,7 +8,7 @@ import Loading, { Error } from '../common/loading';
import { FetchProtobuf, useProtoSWR } from '../common/proto';
import { SettingCheck, SettingTypeSelect } from "../common/switch";
import { GlobalToastContext } from '../common/toast';
-import { setting as Setting, system_proxySchema } from '../pbes/config/config_pb';
+import { advanced_configSchema, setting as Setting, system_proxySchema } from '../pbes/config/config_pb';
import { config_service } from '../pbes/config/grpc/config_pb';
import { log_level, log_levelSchema } from '../pbes/config/log/log_pb';
import { Remind, SettingInputText } from './components';
@@ -112,6 +112,30 @@ function ConfigComponent() {
onChange={(e) => setSetting({ ...setting, logcat: { ...setting.logcat, level: e } }, false)}
/>
+
+
+ Advanced
+
+ UDP Buffer Size ({setting.advancedConfig ? setting.advancedConfig.udpBufferSize : 2048} Bytes)
+ {
+ setSetting(prev => {
+ const tmp = { ...prev }
+ if (!tmp.advancedConfig) tmp.advancedConfig = create(advanced_configSchema, { udpBufferSize: v.target.valueAsNumber, relayBufferSize: 4096 })
+ else tmp.advancedConfig = { ...tmp.advancedConfig, udpBufferSize: v.target.valueAsNumber }
+ return tmp
+ }, false)
+ }
+ } />
+
+ Relay Buffer Size ({setting.advancedConfig ? setting.advancedConfig.relayBufferSize : 4096} Bytes)
+ setSetting(prev => {
+ const tmp = { ...prev }
+ if (!tmp.advancedConfig) tmp.advancedConfig = create(advanced_configSchema, { relayBufferSize: v.target.valueAsNumber, udpBufferSize: 2048 })
+ else tmp.advancedConfig = { ...tmp.advancedConfig, relayBufferSize: v.target.valueAsNumber }
+ return tmp
+ }, false)} />
diff --git a/app/docs/pbes/config/config_pb.ts b/app/docs/pbes/config/config_pb.ts
index c2024e8..d607f0b 100644
--- a/app/docs/pbes/config/config_pb.ts
+++ b/app/docs/pbes/config/config_pb.ts
@@ -19,7 +19,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file config/config.proto.
*/
export const file_config_config: GenFile = /*@__PURE__*/
- fileDesc("ChNjb25maWcvY29uZmlnLnByb3RvEg55dWhhaWluLmNvbmZpZyLgAwoHc2V0dGluZxIMCgRpcHY2GAcgASgIEkYKHmlwdjZfbG9jYWxfYWRkcl9wcmVmZXJfdW5pY2FzdBgKIAEoCFIeaXB2Nl9sb2NhbF9hZGRyX3ByZWZlcl91bmljYXN0EiQKDW5ldF9pbnRlcmZhY2UYBiABKAlSDW5ldF9pbnRlcmZhY2USQAoMc3lzdGVtX3Byb3h5GAEgASgLMhwueXVoYWlpbi5jb25maWcuc3lzdGVtX3Byb3h5UgxzeXN0ZW1fcHJveHkSJgoGYnlwYXNzGAIgASgLMhYueXVoYWlpbi5ieXBhc3MuY29uZmlnEiQKA2RucxgEIAEoCzIXLnl1aGFpaW4uZG5zLmRuc19jb25maWcSMAoGc2VydmVyGAUgASgLMiAueXVoYWlpbi5saXN0ZW5lci5pbmJvdW5kX2NvbmZpZxIjCgZsb2djYXQYCCABKAsyEy55dWhhaWluLmxvZy5sb2djYXQSRgoOY29uZmlnX3ZlcnNpb24YCSABKAsyHi55dWhhaWluLmNvbmZpZy5jb25maWdfdmVyc2lvblIOY29uZmlnX3ZlcnNpb24SKgoIcGxhdGZvcm0YCyABKAsyGC55dWhhaWluLmNvbmZpZy5wbGF0Zm9ybSIsCgxzeXN0ZW1fcHJveHkSDAoEaHR0cBgCIAEoCBIOCgZzb2NrczUYAyABKAgitAEKBGluZm8SDwoHdmVyc2lvbhgBIAEoCRIOCgZjb21taXQYAiABKAkSHgoKYnVpbGRfdGltZRgDIAEoCVIKYnVpbGRfdGltZRIeCgpnb192ZXJzaW9uGAQgASgJUgpnb192ZXJzaW9uEgwKBGFyY2gYBSABKAkSEAoIcGxhdGZvcm0YBiABKAkSCgoCb3MYByABKAkSEAoIY29tcGlsZXIYCCABKAkSDQoFYnVpbGQYCSADKAkiIQoOY29uZmlnX3ZlcnNpb24SDwoHdmVyc2lvbhgBIAEoBCIsCghwbGF0Zm9ybRIgCgthbmRyb2lkX2FwcBgBIAEoCFILYW5kcm9pZF9hcHBCOFouZ2l0aHViLmNvbS9Bc3V0b3J1ZmEveXVoYWlpbi9wa2cvcHJvdG9zL2NvbmZpZ5IDBdI+AhADYghlZGl0aW9uc3DoBw", [file_config_log_log, file_config_bypass_bypass, file_config_dns_dns, file_config_listener_listener, file_google_protobuf_go_features]);
+ fileDesc("ChNjb25maWcvY29uZmlnLnByb3RvEg55dWhhaWluLmNvbmZpZyKrBAoHc2V0dGluZxIMCgRpcHY2GAcgASgIEkYKHmlwdjZfbG9jYWxfYWRkcl9wcmVmZXJfdW5pY2FzdBgKIAEoCFIeaXB2Nl9sb2NhbF9hZGRyX3ByZWZlcl91bmljYXN0EiQKDW5ldF9pbnRlcmZhY2UYBiABKAlSDW5ldF9pbnRlcmZhY2USQAoMc3lzdGVtX3Byb3h5GAEgASgLMhwueXVoYWlpbi5jb25maWcuc3lzdGVtX3Byb3h5UgxzeXN0ZW1fcHJveHkSJgoGYnlwYXNzGAIgASgLMhYueXVoYWlpbi5ieXBhc3MuY29uZmlnEiQKA2RucxgEIAEoCzIXLnl1aGFpaW4uZG5zLmRuc19jb25maWcSMAoGc2VydmVyGAUgASgLMiAueXVoYWlpbi5saXN0ZW5lci5pbmJvdW5kX2NvbmZpZxIjCgZsb2djYXQYCCABKAsyEy55dWhhaWluLmxvZy5sb2djYXQSRgoOY29uZmlnX3ZlcnNpb24YCSABKAsyHi55dWhhaWluLmNvbmZpZy5jb25maWdfdmVyc2lvblIOY29uZmlnX3ZlcnNpb24SKgoIcGxhdGZvcm0YCyABKAsyGC55dWhhaWluLmNvbmZpZy5wbGF0Zm9ybRJJCg9hZHZhbmNlZF9jb25maWcYDCABKAsyHy55dWhhaWluLmNvbmZpZy5hZHZhbmNlZF9jb25maWdSD2FkdmFuY2VkX2NvbmZpZyJpCg9hZHZhbmNlZF9jb25maWcSKAoPdWRwX2J1ZmZlcl9zaXplGAEgASgFUg91ZHBfYnVmZmVyX3NpemUSLAoRcmVsYXlfYnVmZmVyX3NpemUYAiABKAVSEXJlbGF5X2J1ZmZlcl9zaXplIiwKDHN5c3RlbV9wcm94eRIMCgRodHRwGAIgASgIEg4KBnNvY2tzNRgDIAEoCCK0AQoEaW5mbxIPCgd2ZXJzaW9uGAEgASgJEg4KBmNvbW1pdBgCIAEoCRIeCgpidWlsZF90aW1lGAMgASgJUgpidWlsZF90aW1lEh4KCmdvX3ZlcnNpb24YBCABKAlSCmdvX3ZlcnNpb24SDAoEYXJjaBgFIAEoCRIQCghwbGF0Zm9ybRgGIAEoCRIKCgJvcxgHIAEoCRIQCghjb21waWxlchgIIAEoCRINCgVidWlsZBgJIAMoCSIhCg5jb25maWdfdmVyc2lvbhIPCgd2ZXJzaW9uGAEgASgEIiwKCHBsYXRmb3JtEiAKC2FuZHJvaWRfYXBwGAEgASgIUgthbmRyb2lkX2FwcEI4Wi5naXRodWIuY29tL0FzdXRvcnVmYS95dWhhaWluL3BrZy9wcm90b3MvY29uZmlnkgMF0j4CEANiCGVkaXRpb25zcOgH", [file_config_log_log, file_config_bypass_bypass, file_config_dns_dns, file_config_listener_listener, file_google_protobuf_go_features]);
/**
* @generated from message yuhaiin.config.setting
@@ -76,6 +76,11 @@ export type setting = Message<"yuhaiin.config.setting"> & {
* @generated from field: yuhaiin.config.platform platform = 11;
*/
platform?: platform;
+
+ /**
+ * @generated from field: yuhaiin.config.advanced_config advanced_config = 12 [json_name = "advanced_config"];
+ */
+ advancedConfig?: advanced_config;
};
/**
@@ -85,6 +90,28 @@ export type setting = Message<"yuhaiin.config.setting"> & {
export const settingSchema: GenMessage = /*@__PURE__*/
messageDesc(file_config_config, 0);
+/**
+ * @generated from message yuhaiin.config.advanced_config
+ */
+export type advanced_config = Message<"yuhaiin.config.advanced_config"> & {
+ /**
+ * @generated from field: int32 udp_buffer_size = 1 [json_name = "udp_buffer_size"];
+ */
+ udpBufferSize: number;
+
+ /**
+ * @generated from field: int32 relay_buffer_size = 2 [json_name = "relay_buffer_size"];
+ */
+ relayBufferSize: number;
+};
+
+/**
+ * Describes the message yuhaiin.config.advanced_config.
+ * Use `create(advanced_configSchema)` to create a new message.
+ */
+export const advanced_configSchema: GenMessage = /*@__PURE__*/
+ messageDesc(file_config_config, 1);
+
/**
* @generated from message yuhaiin.config.system_proxy
*/
@@ -105,7 +132,7 @@ export type system_proxy = Message<"yuhaiin.config.system_proxy"> & {
* Use `create(system_proxySchema)` to create a new message.
*/
export const system_proxySchema: GenMessage = /*@__PURE__*/
- messageDesc(file_config_config, 1);
+ messageDesc(file_config_config, 2);
/**
* @generated from message yuhaiin.config.info
@@ -162,7 +189,7 @@ export type info = Message<"yuhaiin.config.info"> & {
* Use `create(infoSchema)` to create a new message.
*/
export const infoSchema: GenMessage = /*@__PURE__*/
- messageDesc(file_config_config, 2);
+ messageDesc(file_config_config, 3);
/**
* @generated from message yuhaiin.config.config_version
@@ -179,7 +206,7 @@ export type config_version = Message<"yuhaiin.config.config_version"> & {
* Use `create(config_versionSchema)` to create a new message.
*/
export const config_versionSchema: GenMessage = /*@__PURE__*/
- messageDesc(file_config_config, 3);
+ messageDesc(file_config_config, 4);
/**
* @generated from message yuhaiin.config.platform
@@ -196,5 +223,5 @@ export type platform = Message<"yuhaiin.config.platform"> & {
* Use `create(platformSchema)` to create a new message.
*/
export const platformSchema: GenMessage = /*@__PURE__*/
- messageDesc(file_config_config, 4);
+ messageDesc(file_config_config, 5);
diff --git a/package-lock.json b/package-lock.json
index e01d467..822c7a5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,7 @@
"@bufbuild/buf": "^1.50.0",
"@bufbuild/protobuf": "^2.2.3",
"@bufbuild/protoc-gen-es": "^2.2.3",
- "@types/node": "^22.10.10",
+ "@types/node": "^22.12.0",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"bootstrap": "^v5.3.3",
@@ -23,7 +23,7 @@
"typescript": "^5.7.3"
},
"devDependencies": {
- "eslint": "^9.18.0",
+ "eslint": "^9.19.0",
"eslint-config-next": "^15.1.6"
}
},
@@ -334,9 +334,9 @@
}
},
"node_modules/@eslint/js": {
- "version": "9.18.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz",
- "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==",
+ "version": "9.19.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz",
+ "integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -1116,9 +1116,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
- "version": "22.10.10",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz",
- "integrity": "sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==",
+ "version": "22.12.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz",
+ "integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"
@@ -2310,9 +2310,9 @@
}
},
"node_modules/eslint": {
- "version": "9.18.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz",
- "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==",
+ "version": "9.19.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.19.0.tgz",
+ "integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2321,7 +2321,7 @@
"@eslint/config-array": "^0.19.0",
"@eslint/core": "^0.10.0",
"@eslint/eslintrc": "^3.2.0",
- "@eslint/js": "9.18.0",
+ "@eslint/js": "9.19.0",
"@eslint/plugin-kit": "^0.2.5",
"@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1",
diff --git a/package.json b/package.json
index ff62ae0..9d136bc 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"@bufbuild/buf": "^1.50.0",
"@bufbuild/protobuf": "^2.2.3",
"@bufbuild/protoc-gen-es": "^2.2.3",
- "@types/node": "^22.10.10",
+ "@types/node": "^22.12.0",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"bootstrap": "^v5.3.3",
@@ -23,7 +23,7 @@
"start": "next start"
},
"devDependencies": {
- "eslint": "^9.18.0",
+ "eslint": "^9.19.0",
"eslint-config-next": "^15.1.6"
}
}
\ No newline at end of file