diff --git a/go.mod b/go.mod index 5ad967f8..71462cbd 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ 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 @@ -24,7 +24,7 @@ require ( 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 @@ -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 @@ -94,7 +94,7 @@ require ( golang.org/x/tools v0.27.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..5b3eed89 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= @@ -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= @@ -227,8 +227,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-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/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.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= 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 8df6577e..e8c3ab5d 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,6 +414,7 @@ class WsStreamSettings extends XrayCommonClass { path: this.path, host: this.host, headers: XrayCommonClass.toV2Headers(this.headers, false), + heartbeatPeriod: this.heartbeatPeriod, }; } } @@ -520,7 +525,7 @@ class HTTPUpgradeStreamSettings extends XrayCommonClass { } } -class SplitHTTPStreamSettings extends XrayCommonClass { +class xHTTPStreamSettings extends XrayCommonClass { constructor( path = '/', host = '', @@ -562,7 +567,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, XrayCommonClass.toHeaders(json.headers), @@ -956,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(); @@ -971,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; } @@ -1021,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), ); } @@ -1040,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, }; } @@ -1177,8 +1182,8 @@ class Inbound extends XrayCommonClass { return this.network === "httpupgrade"; } - get isSplithttp() { - return this.network === "splithttp"; + get isXHTTP() { + return this.network === "xhttp"; } // Shadowsocks @@ -1221,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; } @@ -1236,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; } @@ -1261,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 @@ -1274,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() { @@ -1340,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') { @@ -1413,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; } @@ -1517,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; } @@ -1600,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 35be85d8..5a7722e3 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,6 +230,7 @@ class WsStreamSettings extends CommonClass { return { path: this.path, host: this.host, + heartbeatPeriod: this.heartbeatPeriod }; } } @@ -326,7 +335,7 @@ class HttpUpgradeStreamSettings extends CommonClass { } } -class SplitHTTPStreamSettings extends CommonClass { +class xHTTPStreamSettings extends CommonClass { constructor( path = '/', host = '', @@ -339,7 +348,7 @@ class SplitHTTPStreamSettings extends CommonClass { } static fromJson(json = {}) { - return new SplitHTTPStreamSettings( + return new xHTTPStreamSettings( json.path, json.host, json.mode, @@ -473,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(); @@ -487,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; } @@ -520,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), ); } @@ -538,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, }; } @@ -603,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 @@ -616,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() { @@ -723,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') { @@ -767,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/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..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 @@ -372,16 +375,16 @@ - -