mirror of https://github.com/XTLS/Xray-core
VMess: Returns clearer error in AuthIDDecoderHolder (#5090)
parent
2b82366148
commit
a0c63ba1cf
|
@ -18,6 +18,8 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrNotFound = errors.New("user do not exist")
|
ErrNotFound = errors.New("user do not exist")
|
||||||
|
ErrNeagtiveTime = errors.New("timestamp is negative")
|
||||||
|
ErrInvalidTime = errors.New("invalid timestamp, perhaps unsynchronized time")
|
||||||
ErrReplay = errors.New("replayed request")
|
ErrReplay = errors.New("replayed request")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,11 +104,11 @@ func (a *AuthIDDecoderHolder) Match(authID [16]byte) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if t < 0 {
|
if t < 0 {
|
||||||
continue
|
return nil, ErrNeagtiveTime
|
||||||
}
|
}
|
||||||
|
|
||||||
if math.Abs(math.Abs(float64(t))-float64(time.Now().Unix())) > 120 {
|
if math.Abs(math.Abs(float64(t))-float64(time.Now().Unix())) > 120 {
|
||||||
continue
|
return nil, ErrInvalidTime
|
||||||
}
|
}
|
||||||
|
|
||||||
if !a.filter.Check(authID[:]) {
|
if !a.filter.Check(authID[:]) {
|
||||||
|
|
Loading…
Reference in New Issue