diff --git a/app/db/migrations/versions/20241129_a015ed8ce227_add_shadowtls_protocol.py b/app/db/migrations/versions/20241129_a015ed8ce227_add_shadowtls_protocol.py new file mode 100644 index 0000000..748466a --- /dev/null +++ b/app/db/migrations/versions/20241129_a015ed8ce227_add_shadowtls_protocol.py @@ -0,0 +1,38 @@ +"""add shadowtls protocol + +Revision ID: a015ed8ce227 +Revises: be0032100c07 +Create Date: 2024-11-29 21:41:06.896405 + +""" + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "a015ed8ce227" +down_revision = "be0032100c07" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + bind = op.get_bind() + dialect = bind.dialect.name + + if dialect == "postgresql": + op.execute("ALTER TYPE proxytypes ADD VALUE 'ShadowTLS'") + + elif dialect in ("mariadb", "mysql"): + op.execute( + "ALTER TABLE inbounds MODIFY protocol ENUM('VMess', 'VLESS', 'Trojan', 'Shadowsocks', 'Shadowsocks2022', 'Hysteria2', 'WireGuard', 'TUIC', 'ShadowTLS')" + ) + + +def downgrade() -> None: + bind = op.get_bind() + dialect = bind.dialect.name + + if dialect in ("mysql", "mariadb"): + op.execute( + "ALTER TABLE inbounds MODIFY protocol ENUM('VMess', 'VLESS', 'Trojan', 'Shadowsocks', 'Shadowsocks2022', 'Hysteria2', 'WireGuard', 'TUIC')" + ) diff --git a/app/models/proxy.py b/app/models/proxy.py index 8dfee0d..6e67094 100644 --- a/app/models/proxy.py +++ b/app/models/proxy.py @@ -15,6 +15,7 @@ class ProxyTypes(str, Enum): Hysteria2 = "hysteria2" WireGuard = "wireguard" TUIC = "tuic" + ShadowTLS = "shadowtls" class InboundHostSecurity(str, Enum): diff --git a/app/utils/share.py b/app/utils/share.py index ec546a7..1a22f18 100644 --- a/app/utils/share.py +++ b/app/utils/share.py @@ -317,6 +317,7 @@ def generate_user_configs( "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.3" }, shadowsocks_method="chacha20-ietf-poly1305", + shadowtls_version=inbound.get("shadowtls_version"), weight=host.weight, ) if host.fragment: diff --git a/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/default.ts b/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/default.ts new file mode 100644 index 0000000..95b4d88 --- /dev/null +++ b/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/default.ts @@ -0,0 +1,11 @@ +import { ShadowTlsSchemaType } from "./schema"; + +export const shadowTlsProfileDefaultValue: ShadowTlsSchemaType = { + sni: '', + port: 8080, + address: '', + remark: '', + alpn: "", + allowinsecure: false, + is_disabled: false, +}; diff --git a/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/index.tsx b/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/index.tsx new file mode 100644 index 0000000..b35dc03 --- /dev/null +++ b/dashboard/src/modules/hosts/dialogs/mutation/profiles/shadowtls/index.tsx @@ -0,0 +1,23 @@ +import { + CommonFields, +} from "../../fields"; +import { + TlsFields +} from "../../sections"; +import { + Accordion, +} from "@marzneshin/common/components"; + +export const ShadowTlsProfileFields = () => { + return ( +