Add use remote time for vmess

This commit is contained in:
风扇滑翔翼
2025-09-06 18:23:12 +00:00
committed by GitHub
parent 6ec0291d4e
commit 30e3fa690e
5 changed files with 86 additions and 4 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy/vmess"
xtime "github.com/xtls/xray-core/proxy/vmess/time"
)
func (h *Handler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
@@ -25,7 +26,7 @@ func (h *Handler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
Account: account,
}
dest := net.TCPDestination(cmd.Host, cmd.Port)
until := time.Now().Add(time.Duration(cmd.ValidMin) * time.Minute)
until := xtime.Now().Add(time.Duration(cmd.ValidMin) * time.Minute)
h.serverList.AddServer(protocol.NewServerSpec(dest, protocol.BeforeTime(until), user))
}