diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 6e4fd399..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "gomod" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb038ccc..42e83c89 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.11.21/" + Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v24.11.30/" 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 12617f63..b78b12e3 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.11.21/Xray-linux-${ARCH}.zip" +wget "https://github.com/XTLS/Xray-core/releases/download/v24.11.30/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 5ad967f8..63f4f64e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module x-ui -go 1.23.3 +go 1.23.4 require ( github.com/gin-contrib/gzip v1.0.1 @@ -12,26 +12,26 @@ 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.10 + github.com/shirou/gopsutil/v4 v4.24.11 github.com/valyala/fasthttp v1.57.0 - github.com/xtls/xray-core v1.8.25-0.20241121054707-513f18bf531e + github.com/xtls/xray-core v1.8.25-0.20241130041635-98a72b6fb49b go.uber.org/atomic v1.11.0 - golang.org/x/text v0.20.0 - google.golang.org/grpc v1.68.0 + golang.org/x/text v0.21.0 + google.golang.org/grpc v1.68.1 gorm.io/driver/sqlite v1.5.6 gorm.io/gorm v1.25.12 ) require ( github.com/andybalholm/brotli v1.1.1 // indirect - github.com/bytedance/sonic v1.12.4 // indirect + github.com/bytedance/sonic v1.12.5 // 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.1 // indirect - github.com/fasthttp/router v1.5.2 // indirect + github.com/fasthttp/router v1.5.3 // indirect github.com/gabriel-vasile/mimetype v1.4.7 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -40,7 +40,7 @@ require ( github.com/go-playground/validator/v10 v10.23.0 // 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-20241101162523-b92577c0c142 // indirect + github.com/google/pprof v0.0.0-20241203143554-1e3fdc7de467 // 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 @@ -58,11 +58,11 @@ require ( github.com/mattn/go-sqlite3 v1.14.24 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/onsi/ginkgo/v2 v2.21.0 // indirect + github.com/onsi/ginkgo/v2 v2.22.0 // indirect 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.1 // indirect + github.com/quic-go/quic-go v0.48.2 // 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 @@ -84,17 +84,17 @@ require ( go.uber.org/mock v0.5.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect golang.org/x/arch v0.12.0 // indirect - golang.org/x/crypto v0.29.0 // indirect - golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect + golang.org/x/crypto v0.30.0 // indirect + golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/net v0.31.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect golang.org/x/time v0.8.0 // indirect - golang.org/x/tools v0.27.0 // indirect + golang.org/x/tools v0.28.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-20241118233622-e639e219e697 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect google.golang.org/protobuf v1.35.2 // 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 75db18e2..55f92f4b 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJS github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0/go.mod h1:FVGavL/QEBQDcBpr3fAojoK17xX5k9bicBphrOpP7uM= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= -github.com/bytedance/sonic v1.12.4 h1:9Csb3c9ZJhfUWeMtpCDCq6BUoH5ogfDFLUgQ/jG+R0k= -github.com/bytedance/sonic v1.12.4/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic v1.12.5 h1:hoZxY8uW+mT+OpkcUWw4k0fDINtOcVavEsGfzwzFU/w= +github.com/bytedance/sonic v1.12.5/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.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= @@ -24,8 +24,8 @@ github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 h1:y7y0Oa6UawqTFP github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw= 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/fasthttp/router v1.5.3 h1:BFWXqa3e4thRI3MgPKTNtz0Oiq6UYN2OsEtb+YQ5TMI= +github.com/fasthttp/router v1.5.3/go.mod h1:b864KkDIapOYh77AVG/SNkwfRZ6k6ecWvD+ZRXmP5pw= github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 h1:Arcl6UOIS/kgO2nW3A65HN+7CMjSDP/gofXL4CZt1V4= @@ -66,8 +66,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-20241101162523-b92577c0c142 h1:sAGdeJj0bnMgUNVeUpp6AYlVdCt3/GdI3pGRqsNSQLs= -github.com/google/pprof v0.0.0-20241101162523-b92577c0c142/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241203143554-1e3fdc7de467 h1:keEZFtbLJugfE0qHn+Ge1JCE71spzkchQobDf3mzS/4= +github.com/google/pprof v0.0.0-20241203143554-1e3fdc7de467/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= @@ -113,8 +113,8 @@ github.com/mymmrac/telego v0.31.4 h1:NpiNl0P/8eydknka/k6XaaaWVj5BKMlM3Ibba63QTBU github.com/mymmrac/telego v0.31.4/go.mod h1:T12js1PgbYDYznvoN05MSMuPMfWTYo7D9LKl5cPFWiI= github.com/nicksnyder/go-i18n/v2 v2.4.1 h1:zwzjtX4uYyiaU02K5Ia3zSkpJZrByARkRB4V3YPrr0g= github.com/nicksnyder/go-i18n/v2 v2.4.1/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk= -github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= -github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= @@ -131,8 +131,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.1 h1:y/8xmfWI9qmGTc+lBr4jKRUWLGSlSigv847ULJ4hYXA= -github.com/quic-go/quic-go v0.48.1/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs= +github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE= +github.com/quic-go/quic-go v0.48.2/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= @@ -149,8 +149,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.10 h1:7VOzPtfw/5YDU+jLEoBwXwxJbQetULywoSV4RYY7HkM= -github.com/shirou/gopsutil/v4 v4.24.10/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= +github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8= +github.com/shirou/gopsutil/v4 v4.24.11/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= @@ -160,8 +160,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo= @@ -185,8 +185,8 @@ github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zd github.com/vishvananda/netns v0.0.5/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.20241121054707-513f18bf531e h1:J5sTv0Sw+BonaI+rBh4Jkw9BfBqDjfAts81/HbIaqNg= -github.com/xtls/xray-core v1.8.25-0.20241121054707-513f18bf531e/go.mod h1:wByClH1yrH8I611sREjG62gxbP5hFtdAWYJfydQF/zI= +github.com/xtls/xray-core v1.8.25-0.20241130041635-98a72b6fb49b h1:h8DhM+nmPMo4yKqNnxQ7TZ3e8YiESKm9h0gE45UiNmA= +github.com/xtls/xray-core v1.8.25-0.20241130041635-98a72b6fb49b/go.mod h1:BCeSy6P4xz8vSk46ziVkg0iby82W2Mmqvz2ub5kfYrc= 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= @@ -199,38 +199,38 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= golang.org/x/arch v0.12.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= +golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= +golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0= +golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= -golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= 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-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= -google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= -google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/sub/subService.go b/sub/subService.go index 1659b98b..f52d4b67 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -208,11 +208,6 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { headers, _ := ws["headers"].(map[string]interface{}) obj["host"] = searchHost(headers) } - case "http": - obj["net"] = "h2" - http, _ := stream["httpSettings"].(map[string]interface{}) - obj["path"], _ = http["path"].(string) - obj["host"] = searchHost(http) case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) obj["path"] = grpc["serviceName"].(string) @@ -229,16 +224,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 @@ -361,10 +356,6 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { headers, _ := ws["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "http": - http, _ := stream["httpSettings"].(map[string]interface{}) - params["path"] = http["path"].(string) - params["host"] = searchHost(http) case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) @@ -381,16 +372,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" { @@ -559,10 +550,6 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string headers, _ := ws["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "http": - http, _ := stream["httpSettings"].(map[string]interface{}) - params["path"] = http["path"].(string) - params["host"] = searchHost(http) case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) @@ -579,16 +566,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" { @@ -757,10 +744,6 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st headers, _ := ws["headers"].(map[string]interface{}) params["host"] = searchHost(headers) } - case "http": - http, _ := stream["httpSettings"].(map[string]interface{}) - params["path"] = http["path"].(string) - params["host"] = searchHost(http) case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) @@ -777,16 +760,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 8df6577e..06de3c0f 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -117,6 +117,7 @@ const MODE_OPTION = { AUTO: "auto", PACKET_UP: "packet-up", STREAM_UP: "stream-up", + STREAM_ONE: "stream-one", }; Object.freeze(Protocols); @@ -378,13 +379,15 @@ class WsStreamSettings extends XrayCommonClass { acceptProxyProtocol = false, path = '/', host = '', - headers = [] + headers = [], + heartbeatPeriod = 0, ) { super(); this.acceptProxyProtocol = acceptProxyProtocol; this.path = path; this.host = host; this.headers = headers; + this.heartbeatPeriod = heartbeatPeriod; } addHeader(name, value) { @@ -401,6 +404,7 @@ class WsStreamSettings extends XrayCommonClass { json.path, json.host, XrayCommonClass.toHeaders(json.headers), + json.heartbeatPeriod, ); } @@ -410,46 +414,11 @@ class WsStreamSettings extends XrayCommonClass { path: this.path, host: this.host, headers: XrayCommonClass.toV2Headers(this.headers, false), + heartbeatPeriod: this.heartbeatPeriod, }; } } -class HttpStreamSettings extends XrayCommonClass { - constructor( - path = '/', - host = [''], - ) { - super(); - this.path = path; - this.host = host.length === 0 ? [''] : host; - } - - addHost(host) { - this.host.push(host); - } - - removeHost(index) { - this.host.splice(index, 1); - } - - static fromJson(json = {}) { - return new HttpStreamSettings(json.path, json.host); - } - - toJson() { - let host = []; - for (let i = 0; i < this.host.length; ++i) { - if (!ObjectUtil.isEmpty(this.host[i])) { - host.push(this.host[i]); - } - } - return { - path: this.path, - host: host, - } - } -} - class GrpcStreamSettings extends XrayCommonClass { constructor( serviceName = "", @@ -520,14 +489,14 @@ class HTTPUpgradeStreamSettings extends XrayCommonClass { } } -class SplitHTTPStreamSettings extends XrayCommonClass { +class xHTTPStreamSettings extends XrayCommonClass { constructor( path = '/', host = '', headers = [], - scMaxConcurrentPosts = "100-200", - scMaxEachPostBytes = "1000000-2000000", - scMinPostsIntervalMs = "10-50", + scMaxConcurrentPosts = "100", + scMaxEachPostBytes = "1000000", + scMinPostsIntervalMs = "30", noSSEHeader = false, xPaddingBytes = "100-1000", xmux = { @@ -562,7 +531,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, XrayCommonClass.toHeaders(json.headers), @@ -953,10 +922,9 @@ class StreamSettings extends XrayCommonClass { tcpSettings = new TcpStreamSettings(), kcpSettings = new KcpStreamSettings(), wsSettings = new WsStreamSettings(), - httpSettings = new HttpStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HTTPUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -968,10 +936,9 @@ class StreamSettings extends XrayCommonClass { this.tcp = tcpSettings; this.kcp = kcpSettings; this.ws = wsSettings; - this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -1018,10 +985,9 @@ class StreamSettings extends XrayCommonClass { TcpStreamSettings.fromJson(json.tcpSettings), KcpStreamSettings.fromJson(json.kcpSettings), WsStreamSettings.fromJson(json.wsSettings), - HttpStreamSettings.fromJson(json.httpSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HTTPUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -1037,10 +1003,9 @@ class StreamSettings extends XrayCommonClass { tcpSettings: network === 'tcp' ? this.tcp.toJson() : undefined, kcpSettings: network === 'kcp' ? this.kcp.toJson() : undefined, wsSettings: network === 'ws' ? this.ws.toJson() : undefined, - 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, }; } @@ -1169,16 +1134,12 @@ class Inbound extends XrayCommonClass { return this.network === "grpc"; } - get isH2() { - return this.network === "http"; - } - get isHttpupgrade() { return this.network === "httpupgrade"; } - get isSplithttp() { - return this.network === "splithttp"; + get isXHTTP() { + return this.network === "xhttp"; } // Shadowsocks @@ -1217,12 +1178,10 @@ class Inbound extends XrayCommonClass { return this.getHeader(this.stream.tcp.request, 'host'); } else if (this.isWs) { return this.stream.ws.host?.length > 0 ? this.stream.ws.host : this.getHeader(this.stream.ws, 'host'); - } else if (this.isH2) { - 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; } @@ -1232,12 +1191,10 @@ class Inbound extends XrayCommonClass { return this.stream.tcp.request.path[0]; } else if (this.isWs) { return this.stream.ws.path; - } else if (this.isH2) { - 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; } @@ -1261,7 +1218,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 @@ -1274,7 +1231,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() { @@ -1326,10 +1283,6 @@ class Inbound extends XrayCommonClass { const ws = this.stream.ws; obj.path = ws.path; obj.host = ws.host?.length > 0 ? ws.host : this.getHeader(ws, 'host'); - } else if (network === 'http') { - obj.net = 'h2'; - obj.path = this.stream.http.path; - obj.host = this.stream.http.host.join(','); } else if (network === 'grpc') { obj.path = this.stream.grpc.serviceName; obj.authority = this.stream.grpc.authority; @@ -1340,11 +1293,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') { @@ -1395,11 +1348,6 @@ class Inbound extends XrayCommonClass { params.set("path", ws.path); params.set("host", ws.host?.length > 0 ? ws.host : this.getHeader(ws, 'host')); break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); @@ -1413,11 +1361,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; } @@ -1499,11 +1447,6 @@ class Inbound extends XrayCommonClass { params.set("path", ws.path); params.set("host", ws.host?.length > 0 ? ws.host : this.getHeader(ws, 'host')); break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); @@ -1517,11 +1460,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; } @@ -1582,11 +1525,6 @@ class Inbound extends XrayCommonClass { params.set("path", ws.path); params.set("host", ws.host?.length > 0 ? ws.host : this.getHeader(ws, 'host')); break; - case "http": - const http = this.stream.http; - params.set("path", http.path); - params.set("host", http.host); - break; case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); @@ -1600,11 +1538,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 35be85d8..7a53383c 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -81,6 +81,7 @@ const MODE_OPTION = { AUTO: "auto", PACKET_UP: "packet-up", STREAM_UP: "stream-up", + STREAM_ONE: "stream-one", }; Object.freeze(Protocols); @@ -205,16 +206,23 @@ class KcpStreamSettings extends CommonClass { } class WsStreamSettings extends CommonClass { - constructor(path = '/', host = '') { + constructor( + path = '/', + host = '', + heartbeatPeriod = 0, + + ) { super(); this.path = path; this.host = host; + this.heartbeatPeriod = heartbeatPeriod; } static fromJson(json = {}) { return new WsStreamSettings( json.path, json.host, + json.heartbeatPeriod, ); } @@ -222,63 +230,11 @@ class WsStreamSettings extends CommonClass { return { path: this.path, host: this.host, + heartbeatPeriod: this.heartbeatPeriod }; } } -class HttpStreamSettings extends CommonClass { - constructor(path = '/', host = '') { - super(); - this.path = path; - this.host = host; - } - - static fromJson(json = {}) { - return new HttpStreamSettings( - json.path, - json.host ? json.host.join(',') : '', - ); - } - - toJson() { - return { - path: this.path, - host: ObjectUtil.isEmpty(this.host) ? [''] : this.host.split(','), - } - } -} - -class QuicStreamSettings extends CommonClass { - constructor( - security = 'none', - key = '', - type = 'none' - ) { - super(); - this.security = security; - this.key = key; - this.type = type; - } - - static fromJson(json = {}) { - return new QuicStreamSettings( - json.security, - json.key, - json.header ? json.header.type : 'none', - ); - } - - toJson() { - return { - security: this.security, - key: this.key, - header: { - type: this.type, - } - } - } -} - class GrpcStreamSettings extends CommonClass { constructor( serviceName = "", @@ -326,7 +282,7 @@ class HttpUpgradeStreamSettings extends CommonClass { } } -class SplitHTTPStreamSettings extends CommonClass { +class xHTTPStreamSettings extends CommonClass { constructor( path = '/', host = '', @@ -339,7 +295,7 @@ class SplitHTTPStreamSettings extends CommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, json.mode, @@ -469,11 +425,9 @@ class StreamSettings extends CommonClass { tcpSettings = new TcpStreamSettings(), kcpSettings = new KcpStreamSettings(), wsSettings = new WsStreamSettings(), - httpSettings = new HttpStreamSettings(), - quicSettings = new QuicStreamSettings(), grpcSettings = new GrpcStreamSettings(), httpupgradeSettings = new HttpUpgradeStreamSettings(), - splithttpSettings = new SplitHTTPStreamSettings(), + xhttpSettings = new xHTTPStreamSettings(), sockopt = undefined, ) { super(); @@ -484,10 +438,9 @@ class StreamSettings extends CommonClass { this.tcp = tcpSettings; this.kcp = kcpSettings; this.ws = wsSettings; - this.http = httpSettings; this.grpc = grpcSettings; this.httpupgrade = httpupgradeSettings; - this.splithttp = splithttpSettings; + this.xhttp = xhttpSettings; this.sockopt = sockopt; } @@ -516,11 +469,9 @@ class StreamSettings extends CommonClass { TcpStreamSettings.fromJson(json.tcpSettings), KcpStreamSettings.fromJson(json.kcpSettings), WsStreamSettings.fromJson(json.wsSettings), - HttpStreamSettings.fromJson(json.httpSettings), - QuicStreamSettings.fromJson(json.quicSettings), GrpcStreamSettings.fromJson(json.grpcSettings), HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings), - SplitHTTPStreamSettings.fromJson(json.splithttpSettings), + xHTTPStreamSettings.fromJson(json.xhttpSettings), SockoptStreamSettings.fromJson(json.sockopt), ); } @@ -535,10 +486,9 @@ class StreamSettings extends CommonClass { tcpSettings: network === 'tcp' ? this.tcp.toJson() : undefined, kcpSettings: network === 'kcp' ? this.kcp.toJson() : undefined, wsSettings: network === 'ws' ? this.ws.toJson() : undefined, - 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, }; } @@ -576,7 +526,7 @@ class Mux extends CommonClass { class Outbound extends CommonClass { constructor( tag = '', - protocol = Protocols.VMess, + protocol = Protocols.VLESS, settings = null, streamSettings = new StreamSettings(), sendThrough, @@ -603,7 +553,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 @@ -616,7 +566,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() { @@ -714,17 +664,12 @@ class Outbound extends CommonClass { stream.seed = json.path; } else if (network === 'ws') { stream.ws = new WsStreamSettings(json.path, json.host); - } else if (network === 'http' || network == 'h2') { - stream.network = 'http' - stream.http = new HttpStreamSettings( - json.path, - json.host); } else if (network === 'grpc') { 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') { @@ -758,8 +703,6 @@ class Outbound extends CommonClass { stream.kcp.seed = path; } else if (type === 'ws') { stream.ws = new WsStreamSettings(path, host); - } else if (type === 'http' || type == 'h2') { - stream.http = new HttpStreamSettings(path, host); } else if (type === 'grpc') { stream.grpc = new GrpcStreamSettings( url.searchParams.get('serviceName') ?? '', @@ -767,8 +710,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/controller/index.go b/web/controller/index.go index 2547570c..c74b6fb1 100644 --- a/web/controller/index.go +++ b/web/controller/index.go @@ -69,7 +69,7 @@ func (a *IndexController) login(c *gin.Context) { safePass := template.HTMLEscapeString(form.Password) safeSecret := template.HTMLEscapeString(form.LoginSecret) if user == nil { - logger.Warningf("wrong username or password or secret: \"%s\" \"%s\" \"%s\"", safeUser, safePass, safeSecret) + logger.Warningf("wrong username: \"%s\", password: \"%s\", secret: \"%s\", IP: \"%s\"", safeUser, safePass, safeSecret, getRemoteIp(c)) a.tgbot.UserLoginNotify(safeUser, safePass, getRemoteIp(c), timeStr, 0) pureJsonMsg(c, http.StatusOK, false, I18nWeb(c, "pages.login.toasts.wrongUsernameOrPassword")) return diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html index fde2f27c..fb9e6f41 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -270,10 +270,9 @@ TCP (RAW) mKCP WebSocket - HTTP gRPC HTTPUpgrade - SplitHTTP (XHTTP) + XHTTP @@ -337,15 +336,8 @@ - - - - - - - - - + + @@ -372,16 +364,16 @@ - - + + - + - + - + [[ key ]] diff --git a/web/html/xui/form/stream/stream_http.html b/web/html/xui/form/stream/stream_http.html deleted file mode 100644 index b562c112..00000000 --- a/web/html/xui/form/stream/stream_http.html +++ /dev/null @@ -1,17 +0,0 @@ -{{define "form/streamHTTP"}} - - - - - - {{ i18n "host" }} - - - - - - - - - -{{end}} \ No newline at end of file diff --git a/web/html/xui/form/stream/stream_settings.html b/web/html/xui/form/stream/stream_settings.html index 89493e75..a3119d9c 100644 --- a/web/html/xui/form/stream/stream_settings.html +++ b/web/html/xui/form/stream/stream_settings.html @@ -7,10 +7,9 @@ TCP (RAW) mKCP WebSocket - HTTP gRPC HTTPUpgrade - SplitHTTP (XHTTP) + XHTTP @@ -30,11 +29,6 @@ {{template "form/streamWS"}} - - - {{template "form/streamHTTP"}} - - {{template "form/streamGRPC"}} @@ -45,9 +39,9 @@ {{template "form/streamHTTPUpgrade"}} - - - {{template "form/streamSplitHTTP"}} + + + {{template "form/streamXHTTP"}} 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 @@ + + + diff --git a/web/html/xui/form/stream/stream_splithttp.html b/web/html/xui/form/stream/stream_xhttp.html similarity index 55% rename from web/html/xui/form/stream/stream_splithttp.html rename to web/html/xui/form/stream/stream_xhttp.html index 2d5177bd..621189a0 100644 --- a/web/html/xui/form/stream/stream_splithttp.html +++ b/web/html/xui/form/stream/stream_xhttp.html @@ -1,16 +1,16 @@ -{{define "form/streamSplitHTTP"}} +{{define "form/streamXHTTP"}} - + - + - + - + [[ index+1 ]] @@ -18,45 +18,45 @@ - + @click="inbound.stream.xhttp.removeHeader(index)">- - [[ key ]] - + - + - + - + - + - - + + - - + + - + - + - + {{end}} \ No newline at end of file diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 0e0a18fc..7796cf1e 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -34,7 +34,7 @@ [[ inbound.network ]] - + {{ i18n "host" }} @@ -58,11 +58,11 @@ - + Mode - [[ inbound.stream.splithttp.mode ]] + [[ inbound.stream.xhttp.mode ]] diff --git a/web/service/server.go b/web/service/server.go index 7f078bfd..3198e325 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -286,7 +286,7 @@ func (s *ServerService) GetXrayVersions() ([]string, error) { } if (major == 1 && minor == 8 && patch == 24) || - (major == 24 && ((minor > 11) || (minor == 11 && patch >= 11))) || + (major == 24 && ((minor > 11) || (minor == 11 && patch >= 30))) || (major > 24) { versions = append(versions, release.TagName) } diff --git a/web/service/warp.go b/web/service/warp.go index a691d3c1..5b710f4a 100644 --- a/web/service/warp.go +++ b/web/service/warp.go @@ -8,6 +8,7 @@ import ( "os" "time" "x-ui/logger" + "x-ui/util/common" ) type WarpService struct { @@ -150,13 +151,23 @@ func (s *WarpService) SetWarpLicense(license string) (string, error) { return "", err } + var response map[string]interface{} + err = json.Unmarshal(buffer.Bytes(), &response) + if err != nil { + return "", err + } + if response["success"] == false { + errorArr, _ := response["errors"].([]interface{}) + errorObj := errorArr[0].(map[string]interface{}) + return "", common.NewError(errorObj["code"], errorObj["message"]) + } + warpData["license_key"] = license newWarpData, err := json.MarshalIndent(warpData, "", " ") if err != nil { return "", err } s.SettingService.SetWarp(string(newWarpData)) - println(string(newWarpData)) return string(newWarpData), nil } diff --git a/xray/log_writer.go b/xray/log_writer.go index c8d966b5..cc00d541 100644 --- a/xray/log_writer.go +++ b/xray/log_writer.go @@ -16,11 +16,24 @@ type LogWriter struct { } func (lw *LogWriter) Write(m []byte) (n int, err error) { - regex := regexp.MustCompile(`^(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[([^\]]+)\] (.+)$`) + crashRegex := regexp.MustCompile(`(?i)(panic|exception|stack trace|fatal error)`) + // Convert the data to a string message := strings.TrimSpace(string(m)) + + // Check if the message contains a crash + if crashRegex.MatchString(message) { + logger.Debug("Core crash detected:\n", message) + lw.lastLine = message + err1 := writeCrachReport(m) + if err1 != nil { + logger.Error("Unable to write crash report:", err1) + } + return len(m), nil + } + + regex := regexp.MustCompile(`^(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[([^\]]+)\] (.+)$`) messages := strings.Split(message, "\n") - lw.lastLine = messages[len(messages)-1] for _, msg := range messages { matches := regex.FindStringSubmatch(msg) @@ -42,9 +55,10 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) { default: logger.Debug("XRAY: " + msg) } + lw.lastLine = "" } else if msg != "" { logger.Debug("XRAY: " + msg) - return len(m), nil + lw.lastLine = msg } } diff --git a/xray/process.go b/xray/process.go index 58d14a1f..b4947864 100644 --- a/xray/process.go +++ b/xray/process.go @@ -226,7 +226,6 @@ func (p *process) Start() (err error) { if err != nil { logger.Error("Failure in running xray-core:", err) p.exitErr = err - p.witeCrachReport(err) } }() @@ -243,7 +242,7 @@ func (p *process) Stop() error { return p.cmd.Process.Signal(syscall.SIGTERM) } -func (p *process) witeCrachReport(err error) error { +func writeCrachReport(m []byte) error { crashReportPath := config.GetBinFolderPath() + "/core_crash_" + time.Now().Format("20060102_150405") + ".log" - return os.WriteFile(crashReportPath, []byte(err.Error()), os.ModePerm) + return os.WriteFile(crashReportPath, m, os.ModePerm) }