From 8f36b7ea84f9ea0d1c84c60c65309d712760a29a Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 28 Oct 2024 20:25:38 +0100 Subject: [PATCH 001/131] update dependencies --- go.mod | 16 ++++++++-------- go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index 1107a9ae..453311be 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 github.com/robfig/cron/v3 v3.0.1 github.com/shirou/gopsutil/v4 v4.24.9 - github.com/valyala/fasthttp v1.56.0 - github.com/xtls/xray-core v1.8.25-0.20241005021528-c30f5d47964b + github.com/valyala/fasthttp v1.57.0 + github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4 go.uber.org/atomic v1.11.0 golang.org/x/text v0.19.0 google.golang.org/grpc v1.67.1 @@ -25,12 +25,12 @@ require ( require ( github.com/andybalholm/brotli v1.1.1 // indirect github.com/bytedance/sonic v1.12.3 // indirect - github.com/bytedance/sonic/loader v0.2.0 // indirect + github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cloudflare/circl v1.5.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect - github.com/ebitengine/purego v0.8.0 // indirect + github.com/ebitengine/purego v0.8.1 // indirect github.com/fasthttp/router v1.5.2 // indirect github.com/gabriel-vasile/mimetype v1.4.6 // indirect github.com/gin-contrib/sse v0.1.0 // indirect @@ -40,7 +40,7 @@ require ( github.com/go-playground/validator/v10 v10.22.1 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/pprof v0.0.0-20241009165004-a3522334989c // indirect + github.com/google/pprof v0.0.0-20241023014458-598669927662 // indirect github.com/gorilla/context v1.1.2 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/sessions v1.4.0 // indirect @@ -62,7 +62,7 @@ require ( github.com/pires/go-proxyproto v0.8.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/quic-go/qpack v0.5.1 // indirect - github.com/quic-go/quic-go v0.48.0 // indirect + github.com/quic-go/quic-go v0.48.1 // indirect github.com/refraction-networking/utls v1.6.7 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect @@ -81,7 +81,7 @@ require ( github.com/vishvananda/netns v0.0.4 // indirect github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.uber.org/mock v0.4.0 // indirect + go.uber.org/mock v0.5.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect golang.org/x/arch v0.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect @@ -94,7 +94,7 @@ require ( golang.org/x/tools v0.26.0 // indirect golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 // indirect diff --git a/go.sum b/go.sum index d69876a7..edf78ab2 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOL github.com/bytedance/sonic v1.12.3 h1:W2MGa7RCU1QTeYRTPE3+88mVC0yXmsRQRChiyVocVjU= github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= -github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= +github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cloudflare/circl v1.5.0 h1:hxIWksrX6XN5a1L2TI/h53AGPhNHoUBo+TD1ms9+pys= github.com/cloudflare/circl v1.5.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= @@ -22,8 +22,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw= github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 h1:y7y0Oa6UawqTFPCDw9JG6pdKt4F9pAhHv0B7FMGaGD0= github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw= -github.com/ebitengine/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+GvvE= -github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/fasthttp/router v1.5.2 h1:ckJCCdV7hWkkrMeId3WfEhz+4Gyyf6QPwxi/RHIMZ6I= github.com/fasthttp/router v1.5.2/go.mod h1:C8EY53ozOwpONyevc/V7Gr8pqnEjwnkFFqPo1alAGs0= github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc= @@ -64,8 +64,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20241009165004-a3522334989c h1:NDovD0SMpBYXlE1zJmS1q55vWB/fUQBcPAqAboZSccA= -github.com/google/pprof v0.0.0-20241009165004-a3522334989c/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241023014458-598669927662 h1:SKMkD83p7FwUqKmBsPdLHF5dNyxq3jOWwu9w9UyH5vA= +github.com/google/pprof v0.0.0-20241023014458-598669927662/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o= github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= @@ -129,8 +129,8 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= -github.com/quic-go/quic-go v0.48.0 h1:2TCyvBrMu1Z25rvIAlnp2dPT4lgh/uTqLqiXVpp5AeU= -github.com/quic-go/quic-go v0.48.0/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs= +github.com/quic-go/quic-go v0.48.1 h1:y/8xmfWI9qmGTc+lBr4jKRUWLGSlSigv847ULJ4hYXA= +github.com/quic-go/quic-go v0.48.1/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs= github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM= github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg= @@ -172,8 +172,8 @@ github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.56.0 h1:bEZdJev/6LCBlpdORfrLu/WOZXXxvrUQSiyniuaoW8U= -github.com/valyala/fasthttp v1.56.0/go.mod h1:sReBt3XZVnudxuLOx4J/fMrJVorWRiWY2koQKgABiVI= +github.com/valyala/fasthttp v1.57.0 h1:Xw8SjWGEP/+wAAgyy5XTvgrWlOD1+TxbbvNADYCm1Tg= +github.com/valyala/fasthttp v1.57.0/go.mod h1:h6ZBaPRlzpZ6O3H5t2gEk1Qi33+TmLvfwgLLp0t9CpE= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQdrZk= @@ -182,16 +182,16 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463 h1:g1Cj7d+my6k/HHxLAyxPwyX8i7FGRr6ulBDMkBzg2BM= github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463/go.mod h1:BjIOLmkEEtAgloAiVUcYj0Mt+YU00JARZw8AEU0IwAg= -github.com/xtls/xray-core v1.8.25-0.20241005021528-c30f5d47964b h1:bWuePNnzV4ptnSYJkY96dAg3WgjYbfVgGnasLe3++9w= -github.com/xtls/xray-core v1.8.25-0.20241005021528-c30f5d47964b/go.mod h1:YSvBScSqyzAocGDvzHBbEeoHNrFy8nV6gityRVDvHaM= +github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4 h1:5BMzz1alIs8js5ulsNueLv4zKKEdimFow907lyCsnSE= +github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4/go.mod h1:OlJhs59caMUabGbOamwTc2khBSOfd34qtVJVXFhpfWM= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4= @@ -225,8 +225,8 @@ golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeu golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI= golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4= golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= From 3b3bd3dea4552ced8f8e09c4357ef61e829d2756 Mon Sep 17 00:00:00 2001 From: pr3ci0u5 <115799390+pr3ci0u5@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:03:15 +0300 Subject: [PATCH 002/131] Update translate.ru_RU.toml (#2588) --- web/translation/translate.ru_RU.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 7033a7c3..c056e3ef 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -146,7 +146,7 @@ "meansNoLimit" = "= Без ограничений (значение: ГБ)" "totalFlow" = "Общий расход" "leaveBlankToNeverExpire" = "Оставьте пустым, чтобы не истекало" -"noRecommendKeepDefault" = "Рекомендуется оставить настройки по умолчанию" +"noRecommendKeepDefault" = "Не рекомендуется оставлять настройки по умолчанию" "certificatePath" = "Путь к файлу" "certificateContent" = "Содержимое файла" "publicKey" = "Публичный ключ" @@ -187,7 +187,7 @@ "inboundData" = "Входящие данные" "exportInbound" = "Экспорт входящих" "import" = "Импортировать" -"importInbound" = "Импортировать входящее сообщение" +"importInbound" = "Импортировать подключение" [pages.client] "add" = "Добавить пользователя" @@ -214,7 +214,7 @@ "request" = "Запрос" "response" = "Ответ" "name" = "Имя" -"value" = "Ценить" +"value" = "Значение" [pages.inbounds.stream.tcp] "version" = "Версия" @@ -230,7 +230,7 @@ "save" = "Сохранить" "infoDesc" = "Каждое выполненное изменение необходимо сохранить. Пожалуйста, перезапустите панель, чтобы изменения вступили в силу" "restartPanel" = "Перезапуск панели" -"restartPanelDesc" = "Вы уверены, что хотите перезапустить панель?Нажмите ОК для перезапуска панели через 3 сек. Если вы не можете пользоваться панелью после перезапуска, пожалуйста, посмотрите лог панели на сервере" +"restartPanelDesc" = "Вы уверены, что хотите перезапустить панель? Нажмите ОК для перезапуска панели через 3 сек. Если вы не можете пользоваться панелью после перезапуска, пожалуйста, посмотрите лог панели на сервере" "actions" = "Действия" "resetDefaultConfig" = "Сбросить на конфигурацию по умолчанию" "panelSettings" = "Настройки панели" @@ -402,7 +402,7 @@ "portal" = "Портал" "intercon" = "Соединение" "settings" = "Настройки" -"accountInfo" = "Информация Об учетной записи" +"accountInfo" = "Информация об учетной записи" "outboundStatus" = "Исходящий статус" "sendThrough" = "Отправить через" From e359b5c75e192e03870ae6c201c065740dc13016 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 29 Oct 2024 12:50:25 +0100 Subject: [PATCH 003/131] removed - XTLS Security because its too old and no one use it anymore --- sub/subService.go | 67 +-------- web/assets/js/model/xray.js | 199 --------------------------- web/html/xui/client_bulk_modal.html | 9 -- web/html/xui/form/client.html | 6 - web/html/xui/form/tls_settings.html | 18 +-- web/html/xui/form/xtls_settings.html | 58 -------- web/html/xui/inbound_info_modal.html | 9 -- web/html/xui/inbound_modal.html | 9 -- web/html/xui/inbounds.html | 1 - web/translation/translate.en_US.toml | 2 - web/translation/translate.es_ES.toml | 2 - web/translation/translate.fa_IR.toml | 2 - web/translation/translate.id_ID.toml | 2 - web/translation/translate.pt_BR.toml | 2 - web/translation/translate.ru_RU.toml | 2 - web/translation/translate.tr_TR.toml | 2 - web/translation/translate.uk_UA.toml | 2 - web/translation/translate.vi_VN.toml | 2 - web/translation/translate.zh_CN.toml | 2 - web/translation/translate.zh_TW.toml | 2 - 20 files changed, 3 insertions(+), 395 deletions(-) delete mode 100644 web/html/xui/form/xtls_settings.html diff --git a/sub/subService.go b/sub/subService.go index 33d2e065..2838e932 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -452,38 +452,7 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { } } - if security == "xtls" { - params["security"] = "xtls" - xtlsSetting, _ := stream["xtlsSettings"].(map[string]interface{}) - alpns, _ := xtlsSetting["alpn"].([]interface{}) - var alpn []string - for _, a := range alpns { - alpn = append(alpn, a.(string)) - } - if len(alpn) > 0 { - params["alpn"] = strings.Join(alpn, ",") - } - if sniValue, ok := searchKey(xtlsSetting, "serverName"); ok { - params["sni"], _ = sniValue.(string) - } - xtlsSettings, _ := searchKey(xtlsSetting, "settings") - if xtlsSetting != nil { - if fpValue, ok := searchKey(xtlsSettings, "fingerprint"); ok { - params["fp"], _ = fpValue.(string) - } - if insecure, ok := searchKey(xtlsSettings, "allowInsecure"); ok { - if insecure.(bool) { - params["allowInsecure"] = "1" - } - } - } - - if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 { - params["flow"] = clients[clientIndex].Flow - } - } - - if security != "tls" && security != "reality" && security != "xtls" { + if security != "tls" && security != "reality" { params["security"] = "none" } @@ -676,39 +645,7 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string } } - if security == "xtls" { - params["security"] = "xtls" - xtlsSetting, _ := stream["xtlsSettings"].(map[string]interface{}) - alpns, _ := xtlsSetting["alpn"].([]interface{}) - var alpn []string - for _, a := range alpns { - alpn = append(alpn, a.(string)) - } - if len(alpn) > 0 { - params["alpn"] = strings.Join(alpn, ",") - } - if sniValue, ok := searchKey(xtlsSetting, "serverName"); ok { - params["sni"], _ = sniValue.(string) - } - - xtlsSettings, _ := searchKey(xtlsSetting, "settings") - if xtlsSetting != nil { - if fpValue, ok := searchKey(xtlsSettings, "fingerprint"); ok { - params["fp"], _ = fpValue.(string) - } - if insecure, ok := searchKey(xtlsSettings, "allowInsecure"); ok { - if insecure.(bool) { - params["allowInsecure"] = "1" - } - } - } - - if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 { - params["flow"] = clients[clientIndex].Flow - } - } - - if security != "tls" && security != "reality" && security != "xtls" { + if security != "tls" && security != "reality" { params["security"] = "none" } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 209a3140..b7d68dd8 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -21,11 +21,6 @@ const SSMethods = { BLAKE3_CHACHA20_POLY1305: '2022-blake3-chacha20-poly1305', }; -const XTLS_FLOW_CONTROL = { - ORIGIN: "xtls-rprx-origin", - DIRECT: "xtls-rprx-direct", -}; - const TLS_FLOW_CONTROL = { VISION: "xtls-rprx-vision", VISION_UDP443: "xtls-rprx-vision-udp443", @@ -120,7 +115,6 @@ const USERS_SECURITY = { Object.freeze(Protocols); Object.freeze(SSMethods); -Object.freeze(XTLS_FLOW_CONTROL); Object.freeze(TLS_FLOW_CONTROL); Object.freeze(TLS_VERSION_OPTION); Object.freeze(TLS_CIPHER_OPTION); @@ -755,137 +749,6 @@ TlsStreamSettings.Settings = class extends XrayCommonClass { } }; -class XtlsStreamSettings extends XrayCommonClass { - constructor( - serverName = '', - certificates = [new XtlsStreamSettings.Cert()], - alpn = [ALPN_OPTION.H3, ALPN_OPTION.H2, ALPN_OPTION.HTTP1], - settings = new XtlsStreamSettings.Settings() - ) { - super(); - this.sni = serverName; - this.certs = certificates; - this.alpn = alpn; - this.settings = settings; - } - - addCert() { - this.certs.push(new XtlsStreamSettings.Cert()); - } - - removeCert(index) { - this.certs.splice(index, 1); - } - - static fromJson(json = {}) { - let certs; - let settings; - if (!ObjectUtil.isEmpty(json.certificates)) { - certs = json.certificates.map(cert => XtlsStreamSettings.Cert.fromJson(cert)); - } - - if (!ObjectUtil.isEmpty(json.settings)) { - settings = new XtlsStreamSettings.Settings(json.settings.allowInsecure, json.settings.serverName); - } - return new XtlsStreamSettings( - json.serverName, - certs, - json.alpn, - settings, - ); - } - - toJson() { - return { - serverName: this.sni, - certificates: XtlsStreamSettings.toJsonArray(this.certs), - alpn: this.alpn, - settings: this.settings, - }; - } -} - -XtlsStreamSettings.Cert = class extends XrayCommonClass { - constructor( - useFile = true, - certificateFile = '', - keyFile = '', - certificate = '', - key = '', - ocspStapling = 3600, - oneTimeLoading = false, - usage = USAGE_OPTION.ENCIPHERMENT - ) { - super(); - this.useFile = useFile; - this.certFile = certificateFile; - this.keyFile = keyFile; - this.cert = Array.isArray(certificate) ? certificate.join('\n') : certificate; - this.key = Array.isArray(key) ? key.join('\n') : key; - this.ocspStapling = ocspStapling; - this.oneTimeLoading = oneTimeLoading; - this.usage = usage; - } - - static fromJson(json = {}) { - if ('certificateFile' in json && 'keyFile' in json) { - return new XtlsStreamSettings.Cert( - true, - json.certificateFile, - json.keyFile, '', '', - json.ocspStapling, - json.oneTimeLoading, - json.usage, - ); - } else { - return new XtlsStreamSettings.Cert( - false, '', '', - json.certificate.join('\n'), - json.key.join('\n'), - json.ocspStapling, - json.oneTimeLoading, - json.usage, - ); - } - } - - toJson() { - if (this.useFile) { - return { - certificateFile: this.certFile, - keyFile: this.keyFile, - ocspStapling: this.ocspStapling, - oneTimeLoading: this.oneTimeLoading, - usage: this.usage, - }; - } else { - return { - certificate: this.cert.split('\n'), - key: this.key.split('\n'), - ocspStapling: this.ocspStapling, - oneTimeLoading: this.oneTimeLoading, - usage: this.usage, - }; - } - } -}; - -XtlsStreamSettings.Settings = class extends XrayCommonClass { - constructor(allowInsecure = false) { - super(); - this.allowInsecure = allowInsecure; - } - static fromJson(json = {}) { - return new XtlsStreamSettings.Settings( - json.allowInsecure, - ); - } - toJson() { - return { - allowInsecure: this.allowInsecure, - }; - } -}; class RealityStreamSettings extends XrayCommonClass { constructor( @@ -1071,7 +934,6 @@ class StreamSettings extends XrayCommonClass { security = 'none', externalProxy = [], tlsSettings = new TlsStreamSettings(), - xtlsSettings = new XtlsStreamSettings(), realitySettings = new RealityStreamSettings(), tcpSettings = new TcpStreamSettings(), kcpSettings = new KcpStreamSettings(), @@ -1087,7 +949,6 @@ class StreamSettings extends XrayCommonClass { this.security = security; this.externalProxy = externalProxy; this.tls = tlsSettings; - this.xtls = xtlsSettings; this.reality = realitySettings; this.tcp = tcpSettings; this.kcp = kcpSettings; @@ -1111,18 +972,6 @@ class StreamSettings extends XrayCommonClass { } } - get isXtls() { - return this.security === "xtls"; - } - - set isXtls(isXtls) { - if (isXtls) { - this.security = 'xtls'; - } else { - this.security = 'none'; - } - } - //for Reality get isReality() { return this.security === "reality"; @@ -1150,7 +999,6 @@ class StreamSettings extends XrayCommonClass { json.security, json.externalProxy, TlsStreamSettings.fromJson(json.tlsSettings), - XtlsStreamSettings.fromJson(json.xtlsSettings), RealityStreamSettings.fromJson(json.realitySettings), TcpStreamSettings.fromJson(json.tcpSettings), KcpStreamSettings.fromJson(json.kcpSettings), @@ -1170,7 +1018,6 @@ class StreamSettings extends XrayCommonClass { security: this.security, externalProxy: this.externalProxy, tlsSettings: this.isTls ? this.tls.toJson() : undefined, - xtlsSettings: this.isXtls ? this.xtls.toJson() : undefined, realitySettings: this.isReality ? this.reality.toJson() : undefined, tcpSettings: network === 'tcp' ? this.tcp.toJson() : undefined, kcpSettings: network === 'kcp' ? this.kcp.toJson() : undefined, @@ -1283,18 +1130,6 @@ class Inbound extends XrayCommonClass { } } - get xtls() { - return this.stream.security === 'xtls'; - } - - set xtls(isXtls) { - if (isXtls) { - this.stream.security = 'xtls'; - } else { - this.stream.security = 'none'; - } - } - get network() { return this.stream.network; } @@ -1349,7 +1184,6 @@ class Inbound extends XrayCommonClass { get serverName() { if (this.stream.isTls) return this.stream.tls.sni; - if (this.stream.isXtls) return this.stream.xtls.sni; if (this.stream.isReality) return this.stream.reality.serverNames; return ""; } @@ -1428,11 +1262,6 @@ class Inbound extends XrayCommonClass { return ["tcp", "http", "grpc"].includes(this.network); } - canEnableXtls() { - if (![Protocols.VLESS, Protocols.TROJAN].includes(this.protocol)) return false; - return this.network === "tcp"; - } - canEnableStream() { return [Protocols.VMESS, Protocols.VLESS, Protocols.TROJAN, Protocols.SHADOWSOCKS].includes(this.protocol); } @@ -1592,18 +1421,6 @@ class Inbound extends XrayCommonClass { } } - else if (security === 'xtls') { - params.set("security", "xtls"); - params.set("alpn", this.stream.xtls.alpn); - if (this.stream.xtls.settings.allowInsecure) { - params.set("allowInsecure", "1"); - } - if (!ObjectUtil.isEmpty(this.stream.xtls.sni)) { - params.set("sni", this.stream.xtls.sni); - } - params.set("flow", flow); - } - else if (security === 'reality') { params.set("security", "reality"); params.set("pbk", this.stream.reality.settings.publicKey); @@ -1801,18 +1618,6 @@ class Inbound extends XrayCommonClass { } } - else if (security === 'xtls') { - params.set("security", "xtls"); - params.set("alpn", this.stream.xtls.alpn); - if (this.stream.xtls.settings.allowInsecure) { - params.set("allowInsecure", "1"); - } - if (!ObjectUtil.isEmpty(this.stream.xtls.sni)) { - params.set("sni", this.stream.xtls.sni); - } - params.set("flow", flow); - } - else { params.set("security", "none"); } @@ -2273,7 +2078,6 @@ Inbound.TrojanSettings = class extends Inbound.Settings { Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { constructor( password = RandomUtil.randomSeq(10), - flow = '', email = RandomUtil.randomLowerAndNum(8), limitIp = 0, totalGB = 0, @@ -2285,7 +2089,6 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { ) { super(); this.password = password; - this.flow = flow; this.email = email; this.limitIp = limitIp; this.totalGB = totalGB; @@ -2299,7 +2102,6 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { toJson() { return { password: this.password, - flow: this.flow, email: this.email, limitIp: this.limitIp, totalGB: this.totalGB, @@ -2314,7 +2116,6 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { static fromJson(json = {}) { return new Inbound.TrojanSettings.Trojan( json.password, - json.flow, json.email, json.limitIp, json.totalGB, diff --git a/web/html/xui/client_bulk_modal.html b/web/html/xui/client_bulk_modal.html index c4e33bb1..671c55c3 100644 --- a/web/html/xui/client_bulk_modal.html +++ b/web/html/xui/client_bulk_modal.html @@ -39,12 +39,6 @@ [[ key ]] - - - {{ i18n "none" }} - [[ key ]] - - - - - diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index d10d0f3c..ceceabd5 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "The IPs history log. (to enable inbound after disabling, clear the log)" "IPLimitlogclear" = "Clear The Log" "setDefaultCert" = "Set Cert from Panel" -"xtlsDesc" = "Xray must be v1.7.5" -"realityDesc" = "Xray must be v1.8.0+" "telegramDesc" = "Please provide Telegram Chat ID. (use '/id' command in the bot) or (@userinfobot)" "subscriptionDesc" = "To find your subscription URL, navigate to the 'Details'. Additionally, you can use the same name for several clients." "info" = "Info" diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index 68797735..b9af3272 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "Registro de historial de IPs (antes de habilitar la entrada después de que haya sido desactivada por el límite de IP, debes borrar el registro)." "IPLimitlogclear" = "Limpiar el Registro" "setDefaultCert" = "Establecer certificado desde el panel" -"xtlsDesc" = "La versión del núcleo de Xray debe ser 1.7.5" -"realityDesc" = "La versión del núcleo de Xray debe ser 1.8.0 o superior." "telegramDesc" = "Por favor, proporciona el ID de Chat de Telegram. (usa el comando '/id' en el bot) o (@userinfobot)" "subscriptionDesc" = "Puedes encontrar tu enlace de suscripción en Detalles, también puedes usar el mismo nombre para varias configuraciones." "info" = "Info" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index cc893028..c7fad84e 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "گزارش تاریخچه آی‌پی. برای فعال کردن ورودی پس از غیرفعال شدن، گزارش را پاک کنید" "IPLimitlogclear" = "پاک کردن گزارش‌ها" "setDefaultCert" = "استفاده از گواهی پنل" -"xtlsDesc" = "ایکس‌ری باید 1.7.5 باشد" -"realityDesc" = "ایکس‌ری باید +1.8.0 باشد" "telegramDesc" = "لطفا شناسه گفتگوی تلگرام را وارد کنید. (از دستور '/id' در ربات استفاده کنید) یا (@userinfobot)" "subscriptionDesc" = "شما می‌توانید لینک سابسکربپشن خودرا در 'جزئیات' پیدا کنید، همچنین می‌توانید از همین نام برای چندین کاربر استفاده‌کنید" "info" = "اطلاعات" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index e785c26b..85f8f967 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "Log histori IP. (untuk mengaktifkan masuk setelah menonaktifkan, hapus log)" "IPLimitlogclear" = "Hapus Log" "setDefaultCert" = "Atur Sertifikat dari Panel" -"xtlsDesc" = "Xray harus versi 1.7.5" -"realityDesc" = "Xray harus versi 1.8.0+" "telegramDesc" = "Harap berikan ID Obrolan Telegram. (gunakan perintah '/id' di bot) atau (@userinfobot)" "subscriptionDesc" = "Untuk menemukan URL langganan Anda, buka 'Rincian'. Selain itu, Anda dapat menggunakan nama yang sama untuk beberapa klien." "info" = "Info" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index bbe2bd24..5effdecb 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "O histórico de IPs. (para ativar o inbound após a desativação, limpe o log)" "IPLimitlogclear" = "Limpar o Log" "setDefaultCert" = "Definir Certificado pelo Painel" -"xtlsDesc" = "O Xray deve ser v1.7.5" -"realityDesc" = "O Xray deve ser v1.8.0+" "telegramDesc" = "Por favor, forneça o ID do Chat do Telegram. (use o comando '/id' no bot) ou (@userinfobot)" "subscriptionDesc" = "Para encontrar seu URL de assinatura, navegue até 'Detalhes'. Além disso, você pode usar o mesmo nome para vários clientes." "info" = "Informações" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index c056e3ef..f185ca3d 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "Лог IP-адресов (перед включением лога IP-адресов, вы должны очистить список)" "IPLimitlogclear" = "Очистить лог" "setDefaultCert" = "Установить сертификат с панели" -"xtlsDesc" = "Версия Xray должна быть не ниже 1.7.5" -"realityDesc" = "Версия Xray должна быть не ниже 1.8.0" "telegramDesc" = "Пожалуйста, укажите ID чата Telegram. (используйте команду '/id' в боте) или (@userinfobot)" "subscriptionDesc" = "Вы можете найти свою ссылку подписки в разделе 'Подробнее', также вы можете использовать одно и то же имя для нескольких конфигураций" "info" = "Информация" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index ecaf2bab..bee64b0f 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "IP geçmiş günlüğü. (devre dışı bırakıldıktan sonra gelini etkinleştirmek için günlüğü temizleyin)" "IPLimitlogclear" = "Günlüğü Temizle" "setDefaultCert" = "Panelden Sertifikayı Ayarla" -"xtlsDesc" = "Xray v1.7.5 olmalıdır" -"realityDesc" = "Xray v1.8.0+ olmalıdır" "telegramDesc" = "Lütfen Telegram Sohbet Kimliği sağlayın. (botta '/id' komutunu kullanın) veya (@userinfobot)" "subscriptionDesc" = "Abonelik URL'inizi bulmak için 'Detaylar'a gidin. Ayrıca, aynı adı birden fazla müşteri için kullanabilirsiniz." "info" = "Bilgi" diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index 2e584f0e..791d2154 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "Журнал історії IP-адрес. (щоб увімкнути вхідну після вимкнення, очистіть журнал)" "IPLimitlogclear" = "Очистити журнал" "setDefaultCert" = "Установити сертифікат з панелі" -"xtlsDesc" = "Xray має бути v1.7.5" -"realityDesc" = "Xray має бути v1.8.0+" "telegramDesc" = "Будь ласка, вкажіть ID чату Telegram. (використовуйте команду '/id' у боті) або (@userinfobot)" "subscriptionDesc" = "Щоб знайти URL-адресу вашої підписки, перейдіть до «Деталі». Крім того, ви можете використовувати одне ім'я для кількох клієнтів." "info" = "Інформація" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index bb5c00f8..cd750891 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "Lịch sử đăng nhập IP (trước khi kích hoạt điểm vào sau khi bị vô hiệu hóa bởi giới hạn IP, bạn nên xóa lịch sử)." "IPLimitlogclear" = "Xóa Lịch sử" "setDefaultCert" = "Đặt chứng chỉ từ bảng điều khiển" -"xtlsDesc" = "Xray core cần phiên bản 1.7.5" -"realityDesc" = "Xray core cần phiên bản 1.8.0 hoặc cao hơn." "telegramDesc" = "Vui lòng cung cấp ID Trò chuyện Telegram. (sử dụng lệnh '/id' trong bot) hoặc (@userinfobot)" "subscriptionDesc" = "Bạn có thể tìm liên kết gói đăng ký của mình trong Chi tiết, cũng như bạn có thể sử dụng cùng tên cho nhiều cấu hình khác nhau" "info" = "Thông tin" diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 35062b30..b5f5cce1 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "IP 历史日志(要启用被禁用的入站流量,请清除日志)" "IPLimitlogclear" = "清除日志" "setDefaultCert" = "从面板设置证书" -"xtlsDesc" = "Xray 核心需要 1.7.5" -"realityDesc" = "Xray 核心需要 1.8.0 及以上版本" "telegramDesc" = "请提供Telegram聊天ID。(在机器人中使用'/id'命令)或(@userinfobot" "subscriptionDesc" = "要找到你的订阅 URL,请导航到“详细信息”。此外,你可以为多个客户端使用相同的名称。" "info" = "信息" diff --git a/web/translation/translate.zh_TW.toml b/web/translation/translate.zh_TW.toml index a7382769..466b2b82 100644 --- a/web/translation/translate.zh_TW.toml +++ b/web/translation/translate.zh_TW.toml @@ -178,8 +178,6 @@ "IPLimitlogDesc" = "IP 歷史日誌(要啟用被禁用的入站流量,請清除日誌)" "IPLimitlogclear" = "清除日誌" "setDefaultCert" = "從面板設定證書" -"xtlsDesc" = "Xray 核心需要 1.7.5" -"realityDesc" = "Xray 核心需要 1.8.0 及以上版本" "telegramDesc" = "請提供Telegram聊天ID。(在機器人中使用'/id'命令)或(@userinfobot" "subscriptionDesc" = "要找到你的訂閱 URL,請導航到“詳細資訊”。此外,你可以為多個客戶端使用相同的名稱。" "info" = "資訊" From 0e3691fdbd5d760298e761b6f483abcbcfb07c77 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 29 Oct 2024 13:21:14 +0100 Subject: [PATCH 004/131] Xray core buggy version removed only v24.10.16 or newer and v1.8.24 --- web/service/server.go | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/web/service/server.go b/web/service/server.go index 0d7874d5..de3eda9d 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -248,28 +248,46 @@ func (s *ServerService) GetStatus(lastStatus *Status) *Status { } func (s *ServerService) GetXrayVersions() ([]string, error) { - url := "https://api.github.com/repos/XTLS/Xray-core/releases" - resp, err := http.Get(url) + const ( + XrayURL = "https://api.github.com/repos/XTLS/Xray-core/releases" + bufferSize = 8192 + ) + + resp, err := http.Get(XrayURL) if err != nil { return nil, err } - defer resp.Body.Close() - buffer := bytes.NewBuffer(make([]byte, 8192)) + + buffer := bytes.NewBuffer(make([]byte, bufferSize)) buffer.Reset() - _, err = buffer.ReadFrom(resp.Body) - if err != nil { + if _, err := buffer.ReadFrom(resp.Body); err != nil { return nil, err } - releases := make([]Release, 0) - err = json.Unmarshal(buffer.Bytes(), &releases) - if err != nil { + var releases []Release + if err := json.Unmarshal(buffer.Bytes(), &releases); err != nil { return nil, err } + var versions []string for _, release := range releases { - if release.TagName >= "v1.7.5" { + tagVersion := strings.TrimPrefix(release.TagName, "v") + tagParts := strings.Split(tagVersion, ".") + if len(tagParts) != 3 { + continue + } + + major, err1 := strconv.Atoi(tagParts[0]) + minor, err2 := strconv.Atoi(tagParts[1]) + patch, err3 := strconv.Atoi(tagParts[2]) + if err1 != nil || err2 != nil || err3 != nil { + continue + } + + if (major == 1 && minor == 8 && patch == 24) || + (major == 24 && ((minor > 10) || (minor == 10 && patch >= 16))) || + (major > 24) { versions = append(versions, release.TagName) } } From 13f7e071285f57327c8c741d5c691ddf2a9f9621 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 29 Oct 2024 15:07:56 +0100 Subject: [PATCH 005/131] bash - Access URL I will add https with domain later --- install.sh | 6 +++++- x-ui.sh | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ecd4fdb1..aaa4f778 100644 --- a/install.sh +++ b/install.sh @@ -142,6 +142,8 @@ config_after_install() { local existing_username=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'username: .+' | awk '{print $2}') local existing_password=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'password: .+' | awk '{print $2}') local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') + local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') + local server_ip=$(curl -s https://api.ipify.org) if [[ ${#existing_webBasePath} -lt 4 ]]; then if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then @@ -149,7 +151,7 @@ config_after_install() { local config_username=$(gen_random_string 10) local config_password=$(gen_random_string 10) - read -p "Would you like to customize the Panel Port settings? (If not, random port will be applied) [y/n]: " config_confirm + read -p "Would you like to customize the Panel Port settings? (If not, a random port will be applied) [y/n]: " config_confirm if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then read -p "Please set up the panel port: " config_port echo -e "${yellow}Your Panel Port is: ${config_port}${plain}" @@ -165,6 +167,7 @@ config_after_install() { echo -e "${green}Password: ${config_password}${plain}" echo -e "${green}Port: ${config_port}${plain}" echo -e "${green}WebBasePath: ${config_webBasePath}${plain}" + echo -e "${green}Access URL: http://${server_ip}:${config_port}${config_webBasePath}${plain}" echo -e "###############################################" echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" else @@ -172,6 +175,7 @@ config_after_install() { echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}" /usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}" echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}" + echo -e "${green}Access URL: http://${server_ip}:${existing_port}${config_webBasePath}${plain}" fi else if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then diff --git a/x-ui.sh b/x-ui.sh index e09d0b05..7d669d5f 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -308,12 +308,19 @@ reset_config() { } check_config() { - info=$(/usr/local/x-ui/x-ui setting -show true) + local info=$(/usr/local/x-ui/x-ui setting -show true) if [[ $? != 0 ]]; then LOGE "get current settings error, please check logs" show_menu + return fi LOGI "${info}" + + local existing_webBasePath=$(echo "$info" | grep -Eo 'webBasePath: .+' | awk '{print $2}') + local existing_port=$(echo "$info" | grep -Eo 'port: .+' | awk '{print $2}') + local server_ip=$(curl -s https://api.ipify.org) + + echo -e "${green}Access URL: http://${server_ip}:${existing_port}${existing_webBasePath}${plain}" } set_port() { From 19a31686da26c0c8a8f0ee255d3b0728524bb95f Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 30 Oct 2024 14:40:41 +0100 Subject: [PATCH 006/131] REALITY: SplitHTTP transport --- web/assets/js/model/{xray.js => inbound.js} | 2 +- web/assets/js/model/outbound.js | 2 +- web/html/xui/inbounds.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename web/assets/js/model/{xray.js => inbound.js} (99%) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/inbound.js similarity index 99% rename from web/assets/js/model/xray.js rename to web/assets/js/model/inbound.js index b7d68dd8..ea6f56fa 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/inbound.js @@ -1259,7 +1259,7 @@ class Inbound extends XrayCommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.TROJAN].includes(this.protocol)) return false; - return ["tcp", "http", "grpc"].includes(this.network); + return ["tcp", "http", "grpc", "splithttp"].includes(this.network); } canEnableStream() { diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 870f555f..d7338645 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -602,7 +602,7 @@ class Outbound extends CommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.Trojan].includes(this.protocol)) return false; - return ["tcp", "http", "grpc"].includes(this.stream.network); + return ["tcp", "http", "grpc", "splithttp"].includes(this.stream.network); } canEnableStream() { diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 32bc431f..a5a4c940 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -548,7 +548,7 @@ - + {{template "component/themeSwitcher" .}} {{template "component/persianDatepicker" .}} From d40fa4685162ddc01f7235b391d23313e3f6fd0f Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 30 Oct 2024 15:24:18 +0100 Subject: [PATCH 007/131] fix access url --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index aaa4f778..7900d98c 100644 --- a/install.sh +++ b/install.sh @@ -167,7 +167,7 @@ config_after_install() { echo -e "${green}Password: ${config_password}${plain}" echo -e "${green}Port: ${config_port}${plain}" echo -e "${green}WebBasePath: ${config_webBasePath}${plain}" - echo -e "${green}Access URL: http://${server_ip}:${config_port}${config_webBasePath}${plain}" + echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}" echo -e "###############################################" echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" else @@ -175,7 +175,7 @@ config_after_install() { echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}" /usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}" echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}" - echo -e "${green}Access URL: http://${server_ip}:${existing_port}${config_webBasePath}${plain}" + echo -e "${green}Access URL: http://${server_ip}:${existing_port}/${config_webBasePath}${plain}" fi else if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then From 5ae587ee813a12e065400186fddb2266543469aa Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 30 Oct 2024 16:35:36 +0100 Subject: [PATCH 008/131] bash - set or reset listenIP we need this if we want to add SSH port forwarding --- main.go | 15 +++++++++++++-- web/service/setting.go | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index cd8989fa..75ab197b 100644 --- a/main.go +++ b/main.go @@ -216,7 +216,7 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri } } -func updateSetting(port int, username string, password string, webBasePath string) { +func updateSetting(port int, username string, password string, webBasePath string, listenIP string) { err := database.InitDB(config.GetDBPath()) if err != nil { fmt.Println("Database initialization failed:", err) @@ -252,6 +252,15 @@ func updateSetting(port int, username string, password string, webBasePath strin fmt.Println("Base URI path set successfully") } } + + if listenIP != "" { + err := settingService.SetListen(listenIP) + if err != nil { + fmt.Println("Failed to set listen IP:", err) + } else { + fmt.Printf("listen %v set successfully", listenIP) + } + } } func updateCert(publicKey string, privateKey string) { @@ -339,6 +348,7 @@ func main() { var username string var password string var webBasePath string + var listenIP string var webCertFile string var webKeyFile string var tgbottoken string @@ -355,6 +365,7 @@ func main() { settingCmd.StringVar(&username, "username", "", "Set login username") settingCmd.StringVar(&password, "password", "", "Set login password") settingCmd.StringVar(&webBasePath, "webBasePath", "", "Set base path for Panel") + settingCmd.StringVar(&listenIP, "listen", "", "set panel listen IP") settingCmd.StringVar(&webCertFile, "webCert", "", "Set path to public key file for panel") settingCmd.StringVar(&webKeyFile, "webCertKey", "", "Set path to private key file for panel") settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "Set token for Telegram bot") @@ -397,7 +408,7 @@ func main() { if reset { resetSetting() } else { - updateSetting(port, username, password, webBasePath) + updateSetting(port, username, password, webBasePath, listenIP) } if show { showSetting(show) diff --git a/web/service/setting.go b/web/service/setting.go index bbdac81d..e3ea3ece 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -243,6 +243,10 @@ func (s *SettingService) GetListen() (string, error) { return s.getString("webListen") } +func (s *SettingService) SetListen(ip string) error { + return s.setString("webListen", ip) +} + func (s *SettingService) GetWebDomain() (string, error) { return s.getString("webDomain") } From c158e6ec736a64fb86ef2404e86dc79295133753 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 30 Oct 2024 20:26:37 +0100 Subject: [PATCH 009/131] getListen & getCert --- main.go | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 75ab197b..84ffca6e 100644 --- a/main.go +++ b/main.go @@ -136,6 +136,15 @@ func showSetting(show bool) { fmt.Println("get webBasePath failed, error info:", err) } + certFile, err := settingService.GetCertFile() + if err != nil { + fmt.Println("get cert file failed, error info:", err) + } + keyFile, err := settingService.GetKeyFile() + if err != nil { + fmt.Println("get key file failed, error info:", err) + } + userService := service.UserService{} userModel, err := userService.GetFirstUser() if err != nil { @@ -149,14 +158,15 @@ func showSetting(show bool) { } fmt.Println("current panel settings as follows:") + if certFile == "" || keyFile == "" { + fmt.Println("Warning: Panel is not secure with SSL") + } else { + fmt.Println("Panel is secure with SSL") + } fmt.Println("username:", username) fmt.Println("password:", userpasswd) fmt.Println("port:", port) - if webBasePath != "" { - fmt.Println("webBasePath:", webBasePath) - } else { - fmt.Println("webBasePath is not set") - } + fmt.Println("webBasePath:", webBasePath) } } @@ -290,6 +300,37 @@ func updateCert(publicKey string, privateKey string) { } } +func GetCertificate(getCert bool) { + if getCert { + settingService := service.SettingService{} + certFile, err := settingService.GetCertFile() + if err != nil { + fmt.Println("get cert file failed, error info:", err) + } + keyFile, err := settingService.GetKeyFile() + if err != nil { + fmt.Println("get key file failed, error info:", err) + } + + fmt.Println("cert:", certFile) + fmt.Println("key:", keyFile) + } +} + +func GetListenIP(getListen bool) { + if getListen { + + settingService := service.SettingService{} + ListenIP, err := settingService.GetListen() + if err != nil { + log.Printf("Failed to retrieve listen IP: %v", err) + return + } + + fmt.Println("listenIP:", ListenIP) + } +} + func migrateDb() { inboundService := service.InboundService{} @@ -349,6 +390,7 @@ func main() { var password string var webBasePath string var listenIP string + var getListen bool var webCertFile string var webKeyFile string var tgbottoken string @@ -357,6 +399,7 @@ func main() { var tgbotRuntime string var reset bool var show bool + var getCert bool var remove_secret bool settingCmd.BoolVar(&reset, "reset", false, "Reset all settings") settingCmd.BoolVar(&show, "show", false, "Display current settings") @@ -365,7 +408,9 @@ func main() { settingCmd.StringVar(&username, "username", "", "Set login username") settingCmd.StringVar(&password, "password", "", "Set login password") settingCmd.StringVar(&webBasePath, "webBasePath", "", "Set base path for Panel") - settingCmd.StringVar(&listenIP, "listen", "", "set panel listen IP") + settingCmd.StringVar(&listenIP, "listenIP", "", "set panel listenIP IP") + settingCmd.BoolVar(&getListen, "getListen", false, "Display current panel listenIP IP") + settingCmd.BoolVar(&getCert, "getCert", false, "Display current certificate settings") settingCmd.StringVar(&webCertFile, "webCert", "", "Set path to public key file for panel") settingCmd.StringVar(&webKeyFile, "webCertKey", "", "Set path to private key file for panel") settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "Set token for Telegram bot") @@ -413,6 +458,12 @@ func main() { if show { showSetting(show) } + if getListen { + GetListenIP(getListen) + } + if getCert { + GetCertificate(getCert) + } if (tgbottoken != "") || (tgbotchatid != "") || (tgbotRuntime != "") { updateTgbotSetting(tgbottoken, tgbotchatid, tgbotRuntime) } @@ -433,7 +484,6 @@ func main() { } else { updateCert(webCertFile, webKeyFile) } - default: fmt.Println("Invalid subcommands") fmt.Println() From eb58314c53c8ffe644fb1be3a3ea33b375d780af Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 31 Oct 2024 01:18:37 +0100 Subject: [PATCH 010/131] bash - remove version limit --- README.md | 2 +- install.sh | 2 +- x-ui.sh | 21 ++++++--------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 35e29b0b..e60d5a95 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) ``` -## Install Old Version (we don't recommend) +## Install legacy Version (we don't recommend) To install your desired version, use following installation command. e.g., ver `v1.7.9`: diff --git a/install.sh b/install.sh index 7900d98c..c6c52000 100644 --- a/install.sh +++ b/install.sh @@ -274,7 +274,7 @@ install_x-ui() { echo -e "x-ui log - Check logs" echo -e "x-ui banlog - Check Fail2ban ban logs" echo -e "x-ui update - Update" - echo -e "x-ui custom - custom version" + echo -e "x-ui legacy - legacy version" echo -e "x-ui install - Install" echo -e "x-ui uninstall - Uninstall" echo -e "----------------------------------------------" diff --git a/x-ui.sh b/x-ui.sh index 7d669d5f..84bd9cc3 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -192,7 +192,7 @@ update_menu() { fi } -custom_version() { +legacy_version() { echo "Enter the panel version (like 2.4.0):" read tag_version @@ -200,17 +200,8 @@ custom_version() { echo "Panel version cannot be empty. Exiting." exit 1 fi - - min_version="2.3.5" - if [[ "$(printf '%s\n' "$tag_version" "$min_version" | sort -V | head -n1)" == "$tag_version" && "$tag_version" != "$min_version" ]]; then - echo "Please use a newer version (at least 2.3.5). Exiting." - exit 1 - fi - - download_link="https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh" - # Use the entered panel version in the download link - install_command="bash <(curl -Ls $download_link) v$tag_version" + install_command="bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/v$tag_version/install.sh") v$tag_version" echo "Downloading and installing panel version $tag_version..." eval $install_command @@ -1476,7 +1467,7 @@ show_menu() { ${green}1.${plain} Install ${green}2.${plain} Update ${green}3.${plain} Update Menu - ${green}4.${plain} Old Version + ${green}4.${plain} Legacy Version ${green}5.${plain} Uninstall ———————————————— ${green}6.${plain} Reset Username & Password & Secret Token @@ -1520,7 +1511,7 @@ show_menu() { check_install && update_menu ;; 4) - check_install && custom_version + check_install && legacy_version ;; 5) check_install && uninstall @@ -1620,8 +1611,8 @@ if [[ $# > 0 ]]; then "update") check_install 0 && update 0 ;; - "custom") - check_install 0 && custom_version 0 + "legacy") + check_install 0 && legacy_version 0 ;; "install") check_uninstall 0 && install 0 From 1bcdc54b68dac487be27295bc31f09e96291b84c Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 31 Oct 2024 09:43:31 +0100 Subject: [PATCH 011/131] Xray Core v24.10.31 --- .github/workflows/release.yml | 2 +- DockerInit.sh | 2 +- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38ee449f..8ad585a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,7 +83,7 @@ jobs: cd x-ui/bin # Download dependencies - Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v24.10.16/" + Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v24.10.31/" if [ "${{ matrix.platform }}" == "amd64" ]; then wget ${Xray_URL}Xray-linux-64.zip unzip Xray-linux-64.zip diff --git a/DockerInit.sh b/DockerInit.sh index aae6b1c4..90e83e9b 100755 --- a/DockerInit.sh +++ b/DockerInit.sh @@ -27,7 +27,7 @@ case $1 in esac mkdir -p build/bin cd build/bin -wget "https://github.com/XTLS/Xray-core/releases/download/v24.10.16/Xray-linux-${ARCH}.zip" +wget "https://github.com/XTLS/Xray-core/releases/download/v24.10.31/Xray-linux-${ARCH}.zip" unzip "Xray-linux-${ARCH}.zip" rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat mv xray "xray-linux-${FNAME}" diff --git a/go.mod b/go.mod index 453311be..1a5c32ba 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/robfig/cron/v3 v3.0.1 github.com/shirou/gopsutil/v4 v4.24.9 github.com/valyala/fasthttp v1.57.0 - github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4 + github.com/xtls/xray-core v1.8.25-0.20241031075831-4ec5c78c3453 go.uber.org/atomic v1.11.0 golang.org/x/text v0.19.0 google.golang.org/grpc v1.67.1 diff --git a/go.sum b/go.sum index edf78ab2..ea99f6dd 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463 h1:g1Cj7d+my6k/HHxLAyxPwyX8i7FGRr6ulBDMkBzg2BM= github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463/go.mod h1:BjIOLmkEEtAgloAiVUcYj0Mt+YU00JARZw8AEU0IwAg= -github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4 h1:5BMzz1alIs8js5ulsNueLv4zKKEdimFow907lyCsnSE= -github.com/xtls/xray-core v1.8.25-0.20241027003920-cf182b0482a4/go.mod h1:OlJhs59caMUabGbOamwTc2khBSOfd34qtVJVXFhpfWM= +github.com/xtls/xray-core v1.8.25-0.20241031075831-4ec5c78c3453 h1:2piT7IYX0SKhYjD+XiJMDZAbY01MkP1HYO54njmisaQ= +github.com/xtls/xray-core v1.8.25-0.20241031075831-4ec5c78c3453/go.mod h1:OlJhs59caMUabGbOamwTc2khBSOfd34qtVJVXFhpfWM= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= From 937bfb4c78db94e972154e1d734ec3d5126d39de Mon Sep 17 00:00:00 2001 From: Sanaei Date: Thu, 31 Oct 2024 09:53:47 +0100 Subject: [PATCH 012/131] SSH Port Forwarding (#2590) * getListen & getCert * SSH Port Forwarding * fix --- x-ui.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/x-ui.sh b/x-ui.sh index 84bd9cc3..e6d262f4 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -1438,6 +1438,85 @@ remove_iplimit() { esac } +SSH_port_forwarding() { + local server_ip=$(curl -s https://api.ipify.org) + local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') + local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') + local existing_listenIP=$(/usr/local/x-ui/x-ui setting -getListen true | grep -Eo 'listenIP: .+' | awk '{print $2}') + local existing_cert=$(/usr/local/x-ui/x-ui setting -getCert true | grep -Eo 'cert: .+' | awk '{print $2}') + local existing_key=$(/usr/local/x-ui/x-ui setting -getCert true | grep -Eo 'key: .+' | awk '{print $2}') + + local config_listenIP="" + local listen_choice="" + + if [[ -n "$existing_cert" && -n "$existing_key" ]]; then + echo -e "${green}Panel is secure with SSL.${plain}" + return 0 + fi + if [[ -z "$existing_cert" && -z "$existing_key" && -z "$existing_listenIP" ]]; then + echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" + echo "Please obtain a certificate or set up SSH port forwarding." + fi + + if [[ -n "$existing_listenIP" && (-z "$existing_cert" && -z "$existing_key") ]]; then + echo -e "\n${green}Current SSH Port Forwarding Configuration:${plain}" + echo -e "Standard SSH command:" + echo -e "${yellow}ssh -L 2222:${existing_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nIf using SSH key:" + echo -e "${yellow}ssh -i -L 2222:${existing_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nAfter connecting, access the panel at:" + echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" + fi + + echo -e "\nChoose an option:" + echo -e "${green}1.${plain} Set listen IP" + echo -e "${green}2.${plain} Clear listen IP" + echo -e "${green}0.${plain} Abort" + read -p "Choose an option: " num + + case "$num" in + 1) + if [[ -z "$existing_listenIP" ]]; then + echo -e "\nNo listenIP configured. Choose an option:" + echo -e "1. Use default IP (127.0.0.1)" + echo -e "2. Set a custom IP" + read -p "Select an option (1 or 2): " listen_choice + + config_listenIP="127.0.0.1" + [[ "$listen_choice" == "2" ]] && read -p "Enter custom IP to listen on: " config_listenIP + + /usr/local/x-ui/x-ui setting -listenIP "${config_listenIP}" >/dev/null 2>&1 + echo -e "${green}listen IP has been set to ${config_listenIP}.${plain}" + restart + else + config_listenIP="${existing_listenIP}" + echo -e "${green}Current listen IP is already set to ${config_listenIP}.${plain}" + fi + + if [[ -n "${config_listenIP}" ]]; then + echo -e "\n${green}SSH Port Forwarding Configuration:${plain}" + echo -e "Standard SSH command:" + echo -e "${yellow}ssh -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nIf using SSH key:" + echo -e "${yellow}ssh -i -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nAfter connecting, access the panel at:" + echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" + fi + ;; + 2) + /usr/local/x-ui/x-ui setting -listenIP ' ' >/dev/null 2>&1 + echo -e "${green}Listen IP has been cleared.${plain}" + restart + ;; + 0) + echo "Operation aborted." + ;; + *) + echo "Invalid option. Exiting." + ;; + esac +} + show_usage() { echo "x-ui control menu usages: " echo "------------------------------------------" @@ -1489,13 +1568,14 @@ show_menu() { ${green}19.${plain} Cloudflare SSL Certificate ${green}20.${plain} IP Limit Management ${green}21.${plain} Firewall Management + ${green}22.${plain} SSH Port Forwarding Management ———————————————— - ${green}22.${plain} Enable BBR - ${green}23.${plain} Update Geo Files - ${green}24.${plain} Speedtest by Ookla + ${green}23.${plain} Enable BBR + ${green}24.${plain} Update Geo Files + ${green}25.${plain} Speedtest by Ookla " show_status - echo && read -p "Please enter your selection [0-24]: " num + echo && read -p "Please enter your selection [0-25]: " num case "${num}" in 0) @@ -1565,16 +1645,19 @@ show_menu() { firewall_menu ;; 22) - bbr_menu + SSH_port_forwarding ;; 23) - update_geo + bbr_menu ;; 24) + update_geo + ;; + 25) run_speedtest ;; *) - LOGE "Please enter the correct number [0-24]" + LOGE "Please enter the correct number [0-25]" ;; esac } From 7abb0922116e7667bd333c4b653141fc6325a047 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 31 Oct 2024 09:54:53 +0100 Subject: [PATCH 013/131] v2.4.6 --- config/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/version b/config/version index 26f8b8bc..62e64205 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -2.4.5 \ No newline at end of file +2.4.6 \ No newline at end of file From 9c065aed4eb48bb35165f60339a9c47bbbfd1514 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 31 Oct 2024 14:43:30 +0100 Subject: [PATCH 014/131] Access URL - after you get SSL --- x-ui.sh | 82 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/x-ui.sh b/x-ui.sh index e6d262f4..0daf0a3c 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -931,6 +931,8 @@ ssl_cert_issue_main() { } ssl_cert_issue() { + local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') + local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') # check for acme.sh first if ! command -v ~/.acme.sh/acme.sh &>/dev/null; then echo "acme.sh could not be found. we will install it" @@ -1049,6 +1051,7 @@ ssl_cert_issue() { LOGI "Panel paths set for domain: $domain" LOGI " - Certificate File: $webCertFile" LOGI " - Private Key File: $webKeyFile" + echo -e "${green}Access URL: https://${domain}:${existing_port}${existing_webBasePath}${plain}" restart else LOGE "Error: Certificate or private key file not found for domain: $domain." @@ -1453,12 +1456,12 @@ SSH_port_forwarding() { echo -e "${green}Panel is secure with SSL.${plain}" return 0 fi - if [[ -z "$existing_cert" && -z "$existing_key" && -z "$existing_listenIP" ]]; then - echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" - echo "Please obtain a certificate or set up SSH port forwarding." + if [[ -z "$existing_cert" && -z "$existing_key" && (-z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0") ]]; then + echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" + echo "Please obtain a certificate or set up SSH port forwarding." fi - if [[ -n "$existing_listenIP" && (-z "$existing_cert" && -z "$existing_key") ]]; then + if [[ -n "$existing_listenIP" && "$existing_listenIP" != "0.0.0.0" && (-z "$existing_cert" && -z "$existing_key") ]]; then echo -e "\n${green}Current SSH Port Forwarding Configuration:${plain}" echo -e "Standard SSH command:" echo -e "${yellow}ssh -L 2222:${existing_listenIP}:${existing_port} root@${server_ip}${plain}" @@ -1467,7 +1470,7 @@ SSH_port_forwarding() { echo -e "\nAfter connecting, access the panel at:" echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" fi - + echo -e "\nChoose an option:" echo -e "${green}1.${plain} Set listen IP" echo -e "${green}2.${plain} Clear listen IP" @@ -1475,45 +1478,42 @@ SSH_port_forwarding() { read -p "Choose an option: " num case "$num" in - 1) - if [[ -z "$existing_listenIP" ]]; then - echo -e "\nNo listenIP configured. Choose an option:" - echo -e "1. Use default IP (127.0.0.1)" - echo -e "2. Set a custom IP" - read -p "Select an option (1 or 2): " listen_choice + 1) + if [[ -z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0" ]]; then + echo -e "\nNo listenIP configured. Choose an option:" + echo -e "1. Use default IP (127.0.0.1)" + echo -e "2. Set a custom IP" + read -p "Select an option (1 or 2): " listen_choice - config_listenIP="127.0.0.1" - [[ "$listen_choice" == "2" ]] && read -p "Enter custom IP to listen on: " config_listenIP + config_listenIP="127.0.0.1" + [[ "$listen_choice" == "2" ]] && read -p "Enter custom IP to listen on: " config_listenIP - /usr/local/x-ui/x-ui setting -listenIP "${config_listenIP}" >/dev/null 2>&1 - echo -e "${green}listen IP has been set to ${config_listenIP}.${plain}" - restart - else - config_listenIP="${existing_listenIP}" - echo -e "${green}Current listen IP is already set to ${config_listenIP}.${plain}" - fi - - if [[ -n "${config_listenIP}" ]]; then - echo -e "\n${green}SSH Port Forwarding Configuration:${plain}" - echo -e "Standard SSH command:" - echo -e "${yellow}ssh -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" - echo -e "\nIf using SSH key:" - echo -e "${yellow}ssh -i -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" - echo -e "\nAfter connecting, access the panel at:" - echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" - fi - ;; - 2) - /usr/local/x-ui/x-ui setting -listenIP ' ' >/dev/null 2>&1 - echo -e "${green}Listen IP has been cleared.${plain}" + /usr/local/x-ui/x-ui setting -listenIP "${config_listenIP}" >/dev/null 2>&1 + echo -e "${green}listen IP has been set to ${config_listenIP}.${plain}" + echo -e "\n${green}SSH Port Forwarding Configuration:${plain}" + echo -e "Standard SSH command:" + echo -e "${yellow}ssh -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nIf using SSH key:" + echo -e "${yellow}ssh -i -L 2222:${config_listenIP}:${existing_port} root@${server_ip}${plain}" + echo -e "\nAfter connecting, access the panel at:" + echo -e "${yellow}http://localhost:2222${existing_webBasePath}${plain}" restart - ;; - 0) - echo "Operation aborted." - ;; - *) - echo "Invalid option. Exiting." - ;; + else + config_listenIP="${existing_listenIP}" + echo -e "${green}Current listen IP is already set to ${config_listenIP}.${plain}" + fi + ;; + 2) + /usr/local/x-ui/x-ui setting -listenIP 0.0.0.0 >/dev/null 2>&1 + echo -e "${green}Listen IP has been cleared.${plain}" + restart + ;; + 0) + echo "Operation aborted." + ;; + *) + echo "Invalid option. Exiting." + ;; esac } From e3576e8a856b5edd2fe8ffac06ab255f6a1df342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 17:40:14 +0100 Subject: [PATCH 015/131] Bump github.com/shirou/gopsutil/v4 from 4.24.9 to 4.24.10 (#2593) Bumps [github.com/shirou/gopsutil/v4](https://github.com/shirou/gopsutil) from 4.24.9 to 4.24.10. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v4.24.9...v4.24.10) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1a5c32ba..3943989d 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/pelletier/go-toml/v2 v2.2.3 github.com/robfig/cron/v3 v3.0.1 - github.com/shirou/gopsutil/v4 v4.24.9 + github.com/shirou/gopsutil/v4 v4.24.10 github.com/valyala/fasthttp v1.57.0 github.com/xtls/xray-core v1.8.25-0.20241031075831-4ec5c78c3453 go.uber.org/atomic v1.11.0 diff --git a/go.sum b/go.sum index ea99f6dd..03b50bf1 100644 --- a/go.sum +++ b/go.sum @@ -147,8 +147,8 @@ github.com/savsgio/gotils v0.0.0-20240704082632-aef3928b8a38 h1:D0vL7YNisV2yqE55 github.com/savsgio/gotils v0.0.0-20240704082632-aef3928b8a38/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= -github.com/shirou/gopsutil/v4 v4.24.9 h1:KIV+/HaHD5ka5f570RZq+2SaeFsb/pq+fp2DGNWYoOI= -github.com/shirou/gopsutil/v4 v4.24.9/go.mod h1:3fkaHNeYsUFCGZ8+9vZVWtbyM1k2eRnlL+bWO8Bxa/Q= +github.com/shirou/gopsutil/v4 v4.24.10 h1:7VOzPtfw/5YDU+jLEoBwXwxJbQetULywoSV4RYY7HkM= +github.com/shirou/gopsutil/v4 v4.24.10/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= From adb08a60cfb7aa30f10410f78a82daf203df28c6 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 3 Nov 2024 10:51:53 +0100 Subject: [PATCH 016/131] rename - splithttp to xhttp --- web/assets/js/model/outbound.js | 2 +- web/html/xui/form/outbound.html | 6 +++--- web/html/xui/form/stream/stream_settings.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index d7338645..78078dd6 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -960,7 +960,7 @@ Outbound.BlackholeSettings = class extends CommonClass { Outbound.DNSSettings = class extends CommonClass { constructor( network = 'udp', - address = '1.1.1.1', + address = '', port = 53, nonIPQuery = 'drop', blockTypes = [] diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index 07b8f275..2f5d8207 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -267,13 +267,13 @@ diff --git a/web/html/xui/form/stream/stream_splithttp.html b/web/html/xui/form/stream/stream_splithttp.html index 957720e9..12cd3cac 100644 --- a/web/html/xui/form/stream/stream_splithttp.html +++ b/web/html/xui/form/stream/stream_splithttp.html @@ -22,6 +22,12 @@ + + + [[ key ]] + + diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 36f165c6..0e0a18fc 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -58,6 +58,14 @@ + diff --git a/web/html/xui/form/stream/stream_ws.html b/web/html/xui/form/stream/stream_ws.html index 80f44c50..16a423ca 100644 --- a/web/html/xui/form/stream/stream_ws.html +++ b/web/html/xui/form/stream/stream_ws.html @@ -9,6 +9,9 @@ + + + From b859327b8ad84dd2b44b9bd3a336a63646833701 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 3 Dec 2024 22:24:34 +0100 Subject: [PATCH 045/131] splithttp to xhttp --- sub/subService.go | 48 ++++++------- web/assets/js/model/inbound.js | 68 +++++++++---------- web/assets/js/model/outbound.js | 24 +++---- web/html/xui/form/outbound.html | 12 ++-- web/html/xui/form/stream/stream_settings.html | 8 +-- ...tream_splithttp.html => stream_xhttp.html} | 38 +++++------ web/html/xui/inbound_info_modal.html | 6 +- 7 files changed, 102 insertions(+), 102 deletions(-) rename web/html/xui/form/stream/{stream_splithttp.html => stream_xhttp.html} (55%) diff --git a/sub/subService.go b/sub/subService.go index 1659b98b..84846241 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -229,16 +229,16 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { headers, _ := httpupgrade["headers"].(map[string]interface{}) obj["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - obj["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + obj["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { obj["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) obj["host"] = searchHost(headers) } - obj["mode"] = splithttp["mode"].(string) + obj["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) obj["tls"] = security @@ -381,16 +381,16 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) if security == "tls" { @@ -579,16 +579,16 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) if security == "tls" { @@ -777,16 +777,16 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st headers, _ := httpupgrade["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "splithttp": - splithttp, _ := stream["splithttpSettings"].(map[string]interface{}) - params["path"] = splithttp["path"].(string) - if host, ok := splithttp["host"].(string); ok && len(host) > 0 { + case "xhttp": + xhttp, _ := stream["xhttpSettings"].(map[string]interface{}) + params["path"] = xhttp["path"].(string) + if host, ok := xhttp["host"].(string); ok && len(host) > 0 { params["host"] = host } else { - headers, _ := splithttp["headers"].(map[string]interface{}) + headers, _ := xhttp["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - params["mode"] = splithttp["mode"].(string) + params["mode"] = xhttp["mode"].(string) } security, _ := stream["security"].(string) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 35f9dc3a..e8c3ab5d 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -525,7 +525,7 @@ class HTTPUpgradeStreamSettings extends XrayCommonClass { } } -class SplitHTTPStreamSettings extends XrayCommonClass { +class xHTTPStreamSettings extends XrayCommonClass { constructor( path = '/', host = '', @@ -567,7 +567,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, XrayCommonClass.toHeaders(json.headers), @@ -961,7 +961,7 @@ class StreamSettings extends XrayCommonClass { httpSettings = new HttpStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HTTPUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -976,7 +976,7 @@ class StreamSettings extends XrayCommonClass { this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -1026,7 +1026,7 @@ class StreamSettings extends XrayCommonClass { HttpStreamSettings.fromJson(json.httpSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HTTPUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -1045,7 +1045,7 @@ class StreamSettings extends XrayCommonClass { httpSettings: network === 'http' ? this.http.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, - splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined, + xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined, sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } @@ -1182,8 +1182,8 @@ class Inbound extends XrayCommonClass { return this.network === "httpupgrade"; } - get isSplithttp() { - return this.network === "splithttp"; + get isXHTTP() { + return this.network === "xhttp"; } // Shadowsocks @@ -1226,8 +1226,8 @@ class Inbound extends XrayCommonClass { return this.stream.http.host[0]; } else if (this.isHttpupgrade) { return this.stream.httpupgrade.host?.length > 0 ? this.stream.httpupgrade.host : this.getHeader(this.stream.httpupgrade, 'host'); - } else if (this.isSplithttp) { - return this.stream.splithttp.host?.length > 0 ? this.stream.splithttp.host : this.getHeader(this.stream.splithttp, 'host'); + } else if (this.isXHTTP) { + return this.stream.xhttp.host?.length > 0 ? this.stream.xhttp.host : this.getHeader(this.stream.xhttp, 'host'); } return null; } @@ -1241,8 +1241,8 @@ class Inbound extends XrayCommonClass { return this.stream.http.path; } else if (this.isHttpupgrade) { return this.stream.httpupgrade.path; - } else if (this.isSplithttp) { - return this.stream.splithttp.path; + } else if (this.isXHTTP) { + return this.stream.xhttp.path; } return null; } @@ -1266,7 +1266,7 @@ class Inbound extends XrayCommonClass { canEnableTls() { if (![Protocols.VMESS, Protocols.VLESS, Protocols.TROJAN, Protocols.SHADOWSOCKS].includes(this.protocol)) return false; - return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.network); + return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.network); } //this is used for xtls-rprx-vision @@ -1279,7 +1279,7 @@ class Inbound extends XrayCommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.TROJAN].includes(this.protocol)) return false; - return ["tcp", "http", "grpc", "splithttp"].includes(this.network); + return ["tcp", "http", "grpc", "xhttp"].includes(this.network); } canEnableStream() { @@ -1345,11 +1345,11 @@ class Inbound extends XrayCommonClass { const httpupgrade = this.stream.httpupgrade; obj.path = httpupgrade.path; obj.host = httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host'); - } else if (network === 'splithttp') { - const splithttp = this.stream.splithttp; - obj.path = splithttp.path; - obj.host = splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'); - obj.mode = splithttp.mode; + } else if (network === 'xhttp') { + const xhttp = this.stream.xhttp; + obj.path = xhttp.path; + obj.host = xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host'); + obj.mode = xhttp.mode; } if (security === 'tls') { @@ -1418,11 +1418,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } @@ -1522,11 +1522,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } @@ -1605,11 +1605,11 @@ class Inbound extends XrayCommonClass { params.set("path", httpupgrade.path); params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host')); break; - case "splithttp": - const splithttp = this.stream.splithttp; - params.set("path", splithttp.path); - params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host')); - params.set("mode", splithttp.mode); + case "xhttp": + const xhttp = this.stream.xhttp; + params.set("path", xhttp.path); + params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host')); + params.set("mode", xhttp.mode); break; } diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index c9400efc..5a7722e3 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -335,7 +335,7 @@ class HttpUpgradeStreamSettings extends CommonClass { } } -class SplitHTTPStreamSettings extends CommonClass { +class xHTTPStreamSettings extends CommonClass { constructor( path = '/', host = '', @@ -348,7 +348,7 @@ class SplitHTTPStreamSettings extends CommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, json.mode, @@ -482,7 +482,7 @@ class StreamSettings extends CommonClass { quicSettings = new QuicStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HttpUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -496,7 +496,7 @@ class StreamSettings extends CommonClass { this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -529,7 +529,7 @@ class StreamSettings extends CommonClass { QuicStreamSettings.fromJson(json.quicSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -547,7 +547,7 @@ class StreamSettings extends CommonClass { httpSettings: network === 'http' ? this.http.toJson() : undefined, grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined, httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined, - splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined, + xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined, sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined, }; } @@ -612,7 +612,7 @@ class Outbound extends CommonClass { canEnableTls() { if (![Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(this.protocol)) return false; - return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.stream.network); + return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.stream.network); } //this is used for xtls-rprx-vision @@ -625,7 +625,7 @@ class Outbound extends CommonClass { canEnableReality() { if (![Protocols.VLESS, Protocols.Trojan].includes(this.protocol)) return false; - return ["tcp", "http", "grpc", "splithttp"].includes(this.stream.network); + return ["tcp", "http", "grpc", "xhttp"].includes(this.stream.network); } canEnableStream() { @@ -732,8 +732,8 @@ class Outbound extends CommonClass { stream.grpc = new GrpcStreamSettings(json.path, json.authority, json.type == 'multi'); } else if (network === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(json.path, json.host); - } else if (network === 'splithttp') { - stream.splithttp = new SplitHTTPStreamSettings(json.path, json.host, json.mode); + } else if (network === 'xhttp') { + stream.xhttp = new xHTTPStreamSettings(json.path, json.host, json.mode); } if (json.tls && json.tls == 'tls') { @@ -776,8 +776,8 @@ class Outbound extends CommonClass { url.searchParams.get('mode') == 'multi'); } else if (type === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(path, host); - } else if (type === 'splithttp') { - stream.splithttp = new SplitHTTPStreamSettings(path, host, mode); + } else if (type === 'xhttp') { + stream.xhttp = new xHTTPStreamSettings(path, host, mode); } if (security == 'tls') { diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index a337ab28..e6d12ee4 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -273,7 +273,7 @@ HTTP gRPC HTTPUpgrade - SplitHTTP (XHTTP) + XHTTP - - @@ -469,7 +469,7 @@ - + @@ -486,10 +486,10 @@