mirror of https://github.com/cbeuw/Cloak
Wrap decryption error
This commit is contained in:
parent
d2131799fc
commit
c17cb034e3
|
|
@ -60,6 +60,7 @@ func decryptClientInfo(fragments authFragments, serverTime time.Time) (info Clie
|
||||||
|
|
||||||
var ErrReplay = errors.New("duplicate random")
|
var ErrReplay = errors.New("duplicate random")
|
||||||
var ErrBadProxyMethod = errors.New("invalid proxy method")
|
var ErrBadProxyMethod = errors.New("invalid proxy method")
|
||||||
|
var ErrBadDecryption = errors.New("decryption/authentication faliure")
|
||||||
|
|
||||||
// AuthFirstPacket checks if the first packet of data is ClientHello or HTTP GET, and checks if it was from a Cloak client
|
// AuthFirstPacket checks if the first packet of data is ClientHello or HTTP GET, and checks if it was from a Cloak client
|
||||||
// if it is from a Cloak client, it returns the ClientInfo with the decrypted fields. It doesn't check if the user
|
// if it is from a Cloak client, it returns the ClientInfo with the decrypted fields. It doesn't check if the user
|
||||||
|
|
@ -79,7 +80,7 @@ func AuthFirstPacket(firstPacket []byte, transport Transport, sta *State) (info
|
||||||
info, err = decryptClientInfo(fragments, sta.WorldState.Now())
|
info, err = decryptClientInfo(fragments, sta.WorldState.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug(err)
|
log.Debug(err)
|
||||||
err = fmt.Errorf("transport %v in correct format but not Cloak: %v", transport, err)
|
err = fmt.Errorf("%w: %v", ErrBadDecryption, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, ok := sta.ProxyBook[info.ProxyMethod]; !ok {
|
if _, ok := sta.ProxyBook[info.ProxyMethod]; !ok {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue