Refactor log (#3446)

* Refactor log

* Add new log methods

* Fix logger test

* Change all logging code

* Clean up pathObj

* Rebase to latest main

* Remove invoking method name after the dot
This commit is contained in:
yuhan6665 2024-06-29 14:32:57 -04:00 committed by GitHub
parent 8320732743
commit 079d0bd8a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
291 changed files with 1837 additions and 2368 deletions

View file

@ -3,6 +3,7 @@ package vmess
import (
"strings"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/uuid"
)
@ -31,7 +32,7 @@ func (a *MemoryAccount) Equals(account protocol.Account) bool {
func (a *Account) AsAccount() (protocol.Account, error) {
id, err := uuid.ParseString(a.Id)
if err != nil {
return nil, newError("failed to parse ID").Base(err).AtError()
return nil, errors.New("failed to parse ID").Base(err).AtError()
}
protoID := protocol.NewID(id)
var AuthenticatedLength, NoTerminationSignal bool

View file

@ -17,6 +17,7 @@ import (
"github.com/xtls/xray-core/common/crypto"
"github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/common/drain"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy/vmess"
vmessaead "github.com/xtls/xray-core/proxy/vmess/aead"
@ -53,7 +54,7 @@ func NewClientSession(ctx context.Context, behaviorSeed int64) *ClientSession {
var err error
session.readDrainer, err = drain.NewBehaviorSeedLimitedDrainer(behaviorSeed, 18, 3266, 64)
if err != nil {
newError("unable to initialize drainer").Base(err).WriteToLog()
errors.LogInfoInner(ctx, err, "unable to initialize drainer")
session.readDrainer = drain.NewNopDrainer()
}
}
@ -79,7 +80,7 @@ func (c *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writ
if header.Command != protocol.RequestCommandMux {
if err := addrParser.WriteAddressPort(buffer, header.Address, header.Port); err != nil {
return newError("failed to writer address and port").Base(err)
return errors.New("failed to writer address and port").Base(err)
}
}
@ -112,7 +113,7 @@ func (c *ClientSession) EncodeRequestBody(request *protocol.RequestHeader, write
var ok bool
padding, ok = sizeParser.(crypto.PaddingLengthGenerator)
if !ok {
return nil, newError("invalid option: RequestOptionGlobalPadding")
return nil, errors.New("invalid option: RequestOptionGlobalPadding")
}
}
@ -173,7 +174,7 @@ func (c *ClientSession) EncodeRequestBody(request *protocol.RequestHeader, write
}
return crypto.NewAuthenticationWriter(auth, sizeParser, writer, request.Command.TransferType(), padding), nil
default:
return nil, newError("invalid option: Security")
return nil, errors.New("invalid option: Security")
}
}
@ -190,12 +191,12 @@ func (c *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.Respon
if n, err := io.ReadFull(reader, aeadEncryptedResponseHeaderLength[:]); err != nil {
c.readDrainer.AcknowledgeReceive(n)
return nil, drain.WithError(c.readDrainer, reader, newError("Unable to Read Header Len").Base(err))
return nil, drain.WithError(c.readDrainer, reader, errors.New("Unable to Read Header Len").Base(err))
} else { // nolint: golint
c.readDrainer.AcknowledgeReceive(n)
}
if decryptedResponseHeaderLengthBinaryBuffer, err := aeadResponseHeaderLengthEncryptionAEAD.Open(nil, aeadResponseHeaderLengthEncryptionIV, aeadEncryptedResponseHeaderLength[:], nil); err != nil {
return nil, drain.WithError(c.readDrainer, reader, newError("Failed To Decrypt Length").Base(err))
return nil, drain.WithError(c.readDrainer, reader, errors.New("Failed To Decrypt Length").Base(err))
} else { // nolint: golint
common.Must(binary.Read(bytes.NewReader(decryptedResponseHeaderLengthBinaryBuffer), binary.BigEndian, &decryptedResponseHeaderLengthBinaryDeserializeBuffer))
decryptedResponseHeaderLength = int(decryptedResponseHeaderLengthBinaryDeserializeBuffer)
@ -211,13 +212,13 @@ func (c *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.Respon
if n, err := io.ReadFull(reader, encryptedResponseHeaderBuffer); err != nil {
c.readDrainer.AcknowledgeReceive(n)
return nil, drain.WithError(c.readDrainer, reader, newError("Unable to Read Header Data").Base(err))
return nil, drain.WithError(c.readDrainer, reader, errors.New("Unable to Read Header Data").Base(err))
} else { // nolint: golint
c.readDrainer.AcknowledgeReceive(n)
}
if decryptedResponseHeaderBuffer, err := aeadResponseHeaderPayloadEncryptionAEAD.Open(nil, aeadResponseHeaderPayloadEncryptionIV, encryptedResponseHeaderBuffer, nil); err != nil {
return nil, drain.WithError(c.readDrainer, reader, newError("Failed To Decrypt Payload").Base(err))
return nil, drain.WithError(c.readDrainer, reader, errors.New("Failed To Decrypt Payload").Base(err))
} else { // nolint: golint
c.responseReader = bytes.NewReader(decryptedResponseHeaderBuffer)
}
@ -226,11 +227,11 @@ func (c *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.Respon
defer buffer.Release()
if _, err := buffer.ReadFullFrom(c.responseReader, 4); err != nil {
return nil, newError("failed to read response header").Base(err).AtWarning()
return nil, errors.New("failed to read response header").Base(err).AtWarning()
}
if buffer.Byte(0) != c.responseHeader {
return nil, newError("unexpected response header. Expecting ", int(c.responseHeader), " but actually ", int(buffer.Byte(0)))
return nil, errors.New("unexpected response header. Expecting ", int(c.responseHeader), " but actually ", int(buffer.Byte(0)))
}
header := &protocol.ResponseHeader{
@ -243,7 +244,7 @@ func (c *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.Respon
buffer.Clear()
if _, err := buffer.ReadFullFrom(c.responseReader, dataLen); err != nil {
return nil, newError("failed to read response command").Base(err)
return nil, errors.New("failed to read response command").Base(err)
}
command, err := UnmarshalCommand(cmdID, buffer.Bytes())
if err == nil {
@ -265,7 +266,7 @@ func (c *ClientSession) DecodeResponseBody(request *protocol.RequestHeader, read
var ok bool
padding, ok = sizeParser.(crypto.PaddingLengthGenerator)
if !ok {
return nil, newError("invalid option: RequestOptionGlobalPadding")
return nil, errors.New("invalid option: RequestOptionGlobalPadding")
}
}
@ -328,7 +329,7 @@ func (c *ClientSession) DecodeResponseBody(request *protocol.RequestHeader, read
}
return crypto.NewAuthenticationReader(auth, sizeParser, reader, request.Command.TransferType(), padding), nil
default:
return nil, newError("invalid option: Security")
return nil, errors.New("invalid option: Security")
}
}

View file

@ -6,6 +6,7 @@ import (
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/serial"
@ -13,11 +14,11 @@ import (
)
var (
ErrCommandTooLarge = newError("Command too large.")
ErrCommandTypeMismatch = newError("Command type mismatch.")
ErrInvalidAuth = newError("Invalid auth.")
ErrInsufficientLength = newError("Insufficient length.")
ErrUnknownCommand = newError("Unknown command.")
ErrCommandTooLarge = errors.New("Command too large.")
ErrCommandTypeMismatch = errors.New("Command type mismatch.")
ErrInvalidAuth = errors.New("Invalid auth.")
ErrInsufficientLength = errors.New("Insufficient length.")
ErrUnknownCommand = errors.New("Unknown command.")
)
func MarshalCommand(command interface{}, writer io.Writer) error {

View file

@ -1,9 +0,0 @@
package encoding
import "github.com/xtls/xray-core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View file

@ -16,6 +16,7 @@ import (
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/crypto"
"github.com/xtls/xray-core/common/drain"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/task"
@ -75,7 +76,7 @@ func (h *SessionHistory) removeExpiredEntries() error {
defer h.Unlock()
if len(h.cache) == 0 {
return newError("nothing to do")
return errors.New("nothing to do")
}
for session, expire := range h.cache {
@ -130,7 +131,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(s.userValidator.GetBehaviorSeed()), 16+38, 3266, 64)
if err != nil {
return nil, newError("failed to initialize drainer").Base(err)
return nil, errors.New("failed to initialize drainer").Base(err)
}
drainConnection := func(e error) error {
@ -147,7 +148,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
}()
if _, err := buffer.ReadFullFrom(reader, protocol.IDBytesLen); err != nil {
return nil, newError("failed to read request header").Base(err)
return nil, errors.New("failed to read request header").Base(err)
}
var decryptor io.Reader
@ -167,20 +168,20 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
if errorReason != nil {
if shouldDrain {
drainer.AcknowledgeReceive(bytesRead)
return nil, drainConnection(newError("AEAD read failed").Base(errorReason))
return nil, drainConnection(errors.New("AEAD read failed").Base(errorReason))
} else {
return nil, drainConnection(newError("AEAD read failed, drain skipped").Base(errorReason))
return nil, drainConnection(errors.New("AEAD read failed, drain skipped").Base(errorReason))
}
}
decryptor = bytes.NewReader(aeadData)
default:
return nil, drainConnection(newError("invalid user").Base(errorAEAD))
return nil, drainConnection(errors.New("invalid user").Base(errorAEAD))
}
drainer.AcknowledgeReceive(int(buffer.Len()))
buffer.Clear()
if _, err := buffer.ReadFullFrom(decryptor, 38); err != nil {
return nil, newError("failed to read request header").Base(err)
return nil, errors.New("failed to read request header").Base(err)
}
request := &protocol.RequestHeader{
@ -195,7 +196,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
sid.key = s.requestBodyKey
sid.nonce = s.requestBodyIV
if !s.sessionHistory.addIfNotExits(sid) {
return nil, newError("duplicated session id, possibly under replay attack, but this is a AEAD request")
return nil, errors.New("duplicated session id, possibly under replay attack, but this is a AEAD request")
}
s.responseHeader = buffer.Byte(33) // 1 byte
@ -219,12 +220,12 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
if paddingLen > 0 {
if _, err := buffer.ReadFullFrom(decryptor, int32(paddingLen)); err != nil {
return nil, newError("failed to read padding").Base(err)
return nil, errors.New("failed to read padding").Base(err)
}
}
if _, err := buffer.ReadFullFrom(decryptor, 4); err != nil {
return nil, newError("failed to read checksum").Base(err)
return nil, errors.New("failed to read checksum").Base(err)
}
fnv1a := fnv.New32a()
@ -233,15 +234,15 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr
expectedHash := binary.BigEndian.Uint32(buffer.BytesFrom(-4))
if actualHash != expectedHash {
return nil, newError("invalid auth, but this is a AEAD request")
return nil, errors.New("invalid auth, but this is a AEAD request")
}
if request.Address == nil {
return nil, newError("invalid remote address")
return nil, errors.New("invalid remote address")
}
if request.Security == protocol.SecurityType_UNKNOWN || request.Security == protocol.SecurityType_AUTO {
return nil, newError("unknown security type: ", request.Security)
return nil, errors.New("unknown security type: ", request.Security)
}
return request, nil
@ -258,7 +259,7 @@ func (s *ServerSession) DecodeRequestBody(request *protocol.RequestHeader, reade
var ok bool
padding, ok = sizeParser.(crypto.PaddingLengthGenerator)
if !ok {
return nil, newError("invalid option: RequestOptionGlobalPadding")
return nil, errors.New("invalid option: RequestOptionGlobalPadding")
}
}
@ -321,7 +322,7 @@ func (s *ServerSession) DecodeRequestBody(request *protocol.RequestHeader, reade
return crypto.NewAuthenticationReader(auth, sizeParser, reader, request.Command.TransferType(), padding), nil
default:
return nil, newError("invalid option: Security")
return nil, errors.New("invalid option: Security")
}
}
@ -382,7 +383,7 @@ func (s *ServerSession) EncodeResponseBody(request *protocol.RequestHeader, writ
var ok bool
padding, ok = sizeParser.(crypto.PaddingLengthGenerator)
if !ok {
return nil, newError("invalid option: RequestOptionGlobalPadding")
return nil, errors.New("invalid option: RequestOptionGlobalPadding")
}
}
@ -445,6 +446,6 @@ func (s *ServerSession) EncodeResponseBody(request *protocol.RequestHeader, writ
return crypto.NewAuthenticationWriter(auth, sizeParser, writer, request.Command.TransferType(), padding), nil
default:
return nil, newError("invalid option: Security")
return nil, errors.New("invalid option: Security")
}
}

View file

@ -1,9 +0,0 @@
package vmess
import "github.com/xtls/xray-core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View file

@ -1,9 +0,0 @@
package inbound
import "github.com/xtls/xray-core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View file

@ -120,11 +120,11 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
for _, user := range config.User {
mUser, err := user.ToMemoryUser()
if err != nil {
return nil, newError("failed to get VMess user").Base(err)
return nil, errors.New("failed to get VMess user").Base(err)
}
if err := handler.AddUser(ctx, mUser); err != nil {
return nil, newError("failed to initiate user").Base(err)
return nil, errors.New("failed to initiate user").Base(err)
}
}
@ -153,17 +153,17 @@ func (h *Handler) GetUser(email string) *protocol.MemoryUser {
func (h *Handler) AddUser(ctx context.Context, user *protocol.MemoryUser) error {
if len(user.Email) > 0 && !h.usersByEmail.Add(user) {
return newError("User ", user.Email, " already exists.")
return errors.New("User ", user.Email, " already exists.")
}
return h.clients.Add(user)
}
func (h *Handler) RemoveUser(ctx context.Context, email string) error {
if email == "" {
return newError("Email must not be empty.")
return errors.New("Email must not be empty.")
}
if !h.usersByEmail.Remove(email) {
return newError("User ", email, " not found.")
return errors.New("User ", email, " not found.")
}
h.clients.Remove(email)
return nil
@ -174,7 +174,7 @@ func transferResponse(timer signal.ActivityUpdater, session *encoding.ServerSess
bodyWriter, err := session.EncodeResponseBody(request, output)
if err != nil {
return newError("failed to start decoding response").Base(err)
return errors.New("failed to start decoding response").Base(err)
}
{
// Optimize for small response packet
@ -211,7 +211,7 @@ func transferResponse(timer signal.ActivityUpdater, session *encoding.ServerSess
func (h *Handler) Process(ctx context.Context, network net.Network, connection stat.Connection, dispatcher routing.Dispatcher) error {
sessionPolicy := h.policyManager.ForLevel(0)
if err := connection.SetReadDeadline(time.Now().Add(sessionPolicy.Timeouts.Handshake)); err != nil {
return newError("unable to set read deadline").Base(err).AtWarning()
return errors.New("unable to set read deadline").Base(err).AtWarning()
}
iConn := connection
@ -234,7 +234,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
Status: log.AccessRejected,
Reason: err,
})
err = newError("invalid request from ", connection.RemoteAddr()).Base(err).AtInfo()
err = errors.New("invalid request from ", connection.RemoteAddr()).Base(err).AtInfo()
}
return err
}
@ -249,10 +249,10 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
})
}
newError("received request for ", request.Destination()).WriteToLog(session.ExportIDToError(ctx))
errors.LogInfo(ctx, "received request for ", request.Destination())
if err := connection.SetReadDeadline(time.Time{}); err != nil {
newError("unable to set back read deadline").Base(err).WriteToLog(session.ExportIDToError(ctx))
errors.LogInfoInner(ctx, err, "unable to set back read deadline")
}
inbound := session.InboundFromContext(ctx)
@ -268,7 +268,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
ctx = policy.ContextWithBufferPolicy(ctx, sessionPolicy.Buffer)
link, err := dispatcher.Dispatch(ctx, request.Destination())
if err != nil {
return newError("failed to dispatch request to ", request.Destination()).Base(err)
return errors.New("failed to dispatch request to ", request.Destination()).Base(err)
}
requestDone := func() error {
@ -276,10 +276,10 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
bodyReader, err := svrSession.DecodeRequestBody(request, reader)
if err != nil {
return newError("failed to start decoding").Base(err)
return errors.New("failed to start decoding").Base(err)
}
if err := buf.Copy(bodyReader, link.Writer, buf.UpdateActivity(timer)); err != nil {
return newError("failed to transfer request").Base(err)
return errors.New("failed to transfer request").Base(err)
}
return nil
}
@ -300,7 +300,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
if err := task.Run(ctx, requestDonePost, responseDone); err != nil {
common.Interrupt(link.Reader)
common.Interrupt(link.Writer)
return newError("connection ends").Base(err)
return errors.New("connection ends").Base(err)
}
return nil
@ -312,7 +312,7 @@ func (h *Handler) generateCommand(ctx context.Context, request *protocol.Request
if h.inboundHandlerManager != nil {
handler, err := h.inboundHandlerManager.GetHandler(ctx, tag)
if err != nil {
newError("failed to get detour handler: ", tag).Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
errors.LogWarningInner(ctx, err, "failed to get detour handler: ", tag)
return nil
}
proxyHandler, port, availableMin := handler.GetRandomInboundProxy()
@ -322,7 +322,7 @@ func (h *Handler) generateCommand(ctx context.Context, request *protocol.Request
availableMin = 255
}
newError("pick detour handler for port ", port, " for ", availableMin, " minutes.").AtDebug().WriteToLog(session.ExportIDToError(ctx))
errors.LogDebug(ctx, "pick detour handler for port ", port, " for ", availableMin, " minutes.")
user := inboundHandler.GetUser(request.User.Email)
if user == nil {
return nil

View file

@ -1,9 +0,0 @@
package outbound
import "github.com/xtls/xray-core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View file

@ -11,6 +11,7 @@ import (
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/common/protocol"
@ -42,7 +43,7 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
for _, rec := range config.Receiver {
s, err := protocol.NewServerSpecFromPB(rec)
if err != nil {
return nil, newError("failed to parse server spec").Base(err)
return nil, errors.New("failed to parse server spec").Base(err)
}
serverList.AddServer(s)
}
@ -61,9 +62,9 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
// Process implements proxy.Outbound.Process().
func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error {
outbounds := session.OutboundsFromContext(ctx)
ob := outbounds[len(outbounds) - 1]
ob := outbounds[len(outbounds)-1]
if !ob.Target.IsValid() {
return newError("target not specified").AtError()
return errors.New("target not specified").AtError()
}
ob.Name = "vmess"
ob.CanSpliceCopy = 3
@ -81,12 +82,12 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
return nil
})
if err != nil {
return newError("failed to find an available destination").Base(err).AtWarning()
return errors.New("failed to find an available destination").Base(err).AtWarning()
}
defer conn.Close()
target := ob.Target
newError("tunneling request to ", target, " via ", rec.Destination().NetAddr()).WriteToLog(session.ExportIDToError(ctx))
errors.LogInfo(ctx, "tunneling request to ", target, " via ", rec.Destination().NetAddr())
command := protocol.RequestCommandTCP
if target.Network == net.Network_UDP {
@ -163,19 +164,19 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
writer := buf.NewBufferedWriter(buf.NewWriter(conn))
if err := session.EncodeRequestHeader(request, writer); err != nil {
return newError("failed to encode request").Base(err).AtWarning()
return errors.New("failed to encode request").Base(err).AtWarning()
}
bodyWriter, err := session.EncodeRequestBody(request, writer)
if err != nil {
return newError("failed to start encoding").Base(err)
return errors.New("failed to start encoding").Base(err)
}
bodyWriter2 := bodyWriter
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
bodyWriter = xudp.NewPacketWriter(bodyWriter, target, xudp.GetGlobalID(ctx))
}
if err := buf.CopyOnceTimeout(input, bodyWriter, time.Millisecond*100); err != nil && err != buf.ErrNotTimeoutReader && err != buf.ErrReadTimeout {
return newError("failed to write first payload").Base(err)
return errors.New("failed to write first payload").Base(err)
}
if err := writer.SetBuffered(false); err != nil {
@ -201,13 +202,13 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
reader := &buf.BufferedReader{Reader: buf.NewReader(conn)}
header, err := session.DecodeResponseHeader(reader)
if err != nil {
return newError("failed to read header").Base(err)
return errors.New("failed to read header").Base(err)
}
h.handleCommand(rec.Destination(), header.Command)
bodyReader, err := session.DecodeResponseBody(request, reader)
if err != nil {
return newError("failed to start encoding response").Base(err)
return errors.New("failed to start encoding response").Base(err)
}
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
bodyReader = xudp.NewPacketReader(&buf.BufferedReader{Reader: bodyReader})
@ -222,7 +223,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
responseDonePost := task.OnSuccess(responseDone, task.Close(output))
if err := task.Run(ctx, requestDone, responseDonePost); err != nil {
return newError("connection ends").Base(err)
return errors.New("connection ends").Base(err)
}
return nil

View file

@ -8,6 +8,7 @@ import (
"sync"
"github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy/vmess/aead"
)
@ -104,6 +105,6 @@ func (v *TimedUserValidator) GetBehaviorSeed() uint64 {
return v.behaviorSeed
}
var ErrNotFound = newError("Not Found")
var ErrNotFound = errors.New("Not Found")
var ErrTainted = newError("ErrTainted")
var ErrTainted = errors.New("ErrTainted")