gitscope
← marzneshin / Diff · cba39e7 → cba39e7
Changes cba39e7..cba39e7
Patch commit
diff --git a/app/models/proxy.py b/app/models/proxy.py
index 802a8a3..b201d5d 100644
--- a/app/models/proxy.py
+++ b/app/models/proxy.py
@@ -26,6 +26,9 @@ InboundHostALPN = Enum(
"h2": "h2",
"http/1.1": "http/1.1",
"h2,http/1.1": "h2,http/1.1",
+ "h3": "h3",
+ "h3,h2": "h3,h2",
+ "h3,h2,http/1.1": "h3,h2,http/1.1",
},
)
diff --git a/dashboard/src/features/hosts/dialogs/mutation/fields/alpn.tsx b/dashboard/src/features/hosts/dialogs/mutation/fields/alpn.tsx
index dd23e1d..845bd0d 100644
--- a/dashboard/src/features/hosts/dialogs/mutation/fields/alpn.tsx
+++ b/dashboard/src/features/hosts/dialogs/mutation/fields/alpn.tsx
@@ -12,10 +12,12 @@ import {
} from "@marzneshin/components";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
+import { alpnOptions } from "@marzneshin/features/hosts";
export const AlpnField = () => {
const { t } = useTranslation();
const form = useFormContext();
+
return (
<FormField
control={form.control}
@@ -30,10 +32,7 @@ export const AlpnField = () => {
</SelectTrigger>
</FormControl>
<SelectContent>
- <SelectItem value="none">None</SelectItem>
- <SelectItem value="h2">h2</SelectItem>
- <SelectItem value="http/1.1">http 1.1</SelectItem>
- <SelectItem value="h2,http/1.1">h2,http/1.1</SelectItem>
+ {alpnOptions.map((option) => (<SelectItem value={option}>{option}</SelectItem>))}
</SelectContent>
</Select>
<FormMessage />
diff --git a/dashboard/src/features/hosts/schema/hosts-schema.ts b/dashboard/src/features/hosts/schema/hosts-schema.ts
index 69b7530..a9440f3 100644
--- a/dashboard/src/features/hosts/schema/hosts-schema.ts
+++ b/dashboard/src/features/hosts/schema/hosts-schema.ts
@@ -9,6 +9,16 @@ const packetsInterval = (v: string | null | undefined) => {
return v ? /^(:?tlshello|[\d-]{1,32})$/.test(v) : false;
};
+export const alpnOptions = [
+ "none",
+ "h2",
+ "h3",
+ "h3,h2",
+ "http/1.1",
+ "h2,http/1.1",
+ "h3,h2,http/1.1"
+]
+
export const HostSchema = z.object({
remark: z.string().min(1, "Remark is required"),
address: z.string().min(1, "Address is required"),
@@ -50,7 +60,7 @@ export const HostSchema = z.object({
.enum(["inbound_default", "none", "tls"])
.default("inbound_default"),
alpn: z
- .enum(["h2", "http/1.1", "h2,http/1.1", "none", ""])
+ .enum(["", ...alpnOptions])
.optional()
.default("none"),
allowinsecure: z.boolean().default(false).optional(),