Refine time usage

This commit is contained in:
风扇滑翔翼
2025-09-10 04:56:41 +00:00
committed by GitHub
parent 033d2ba2b9
commit f42a518bf6
5 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ import (
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/antireplay"
"github.com/xtls/xray-core/proxy/vmess/time"
"github.com/xtls/xray-core/proxy/vmess/vtime"
)
var (
@@ -105,7 +105,7 @@ func (a *AuthIDDecoderHolder) Match(authID [16]byte) (interface{}, error) {
continue
}
if math.Abs(math.Abs(float64(t))-float64(time.Now().Unix())) > 120 {
if math.Abs(math.Abs(float64(t))-float64(vtime.Now().Unix())) > 120 {
continue
}
+1 -1
View File
@@ -4,9 +4,9 @@ import (
"fmt"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/xtls/xray-core/proxy/vmess/time"
)
func TestCreateAuthID(t *testing.T) {
+2 -2
View File
@@ -8,11 +8,11 @@ import (
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/crypto"
"github.com/xtls/xray-core/proxy/vmess/time"
"github.com/xtls/xray-core/proxy/vmess/vtime"
)
func SealVMessAEADHeader(key [16]byte, data []byte) []byte {
generatedAuthID := CreateAuthID(key[:], time.Now().Unix())
generatedAuthID := CreateAuthID(key[:], vtime.Now().Unix())
connectionNonce := make([]byte, 8)
if _, err := io.ReadFull(rand.Reader, connectionNonce); err != nil {