feat: Support config redir port and tproxy port

This commit is contained in:
MystiPanda committed 2024-03-21 10:54:56 +08:00
1 parent d003883de9
commit ae46332e42
7 files changed
+152 -7

No files matched your search

+29 -1
View File
@@ -49,11 +49,19 @@ export const useClashInfo = () => {
patch: Partial<
Pick<
IConfigData,
"port" | "socks-port" | "mixed-port" | "external-controller" | "secret"
| "port"
| "socks-port"
| "mixed-port"
| "redir-port"
| "tproxy-port"
| "external-controller"
| "secret"
>
>
) => {
const hasInfo =
patch["redir-port"] != null ||
patch["tproxy-port"] != null ||
patch["mixed-port"] != null ||
patch["socks-port"] != null ||
patch["port"] != null ||
@@ -62,6 +70,26 @@ export const useClashInfo = () => {
if (!hasInfo) return;
if (patch["redir-port"]) {
const port = patch["redir-port"];
if (port < 1000) {
throw new Error("The port should not < 1000");
}
if (port > 65536) {
throw new Error("The port should not > 65536");
}
}
if (patch["tproxy-port"]) {
const port = patch["tproxy-port"];
if (port < 1000) {
throw new Error("The port should not < 1000");
}
if (port > 65536) {
throw new Error("The port should not > 65536");
}
}
if (patch["mixed-port"]) {
const port = patch["mixed-port"];
if (port < 1000) {