unified drain support for vmess and shadowsockets

This commit is contained in:
Shelikhoo
2021-06-22 12:26:17 +01:00
parent 73ee3b0b1c
commit 79174ab2a0
7 changed files with 153 additions and 66 deletions
+9 -1
View File
@@ -6,6 +6,9 @@ package outbound
import (
"context"
"crypto/hmac"
"crypto/sha256"
"hash/crc64"
"time"
core "github.com/v2fly/v2ray-core/v4"
@@ -128,7 +131,12 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
isAEAD = true
}
session := encoding.NewClientSession(ctx, isAEAD, protocol.DefaultIDHash)
hashkdf := hmac.New(sha256.New, []byte("VMessBF"))
hashkdf.Write(account.ID.Bytes())
behaviorSeed := crc64.Checksum(hashkdf.Sum(nil), crc64.MakeTable(crc64.ISO))
session := encoding.NewClientSession(ctx, isAEAD, protocol.DefaultIDHash, int64(behaviorSeed))
sessionPolicy := h.policyManager.ForLevel(request.User.Level)
ctx, cancel := context.WithCancel(ctx)