1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00

fix(listen): preshard key decode

This commit is contained in:
源文雨
2023-08-03 21:39:48 +08:00
parent 835d92828b
commit 61d979bb41

View File

@@ -62,11 +62,6 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) {
switch {
case p.IsToMe(packet.Dst):
packet.Data = p.Decode(uint8(packet.TeaTypeDataSZ>>28), packet.Data)
if !packet.IsVaildHash() {
logrus.Debugln("[listen] drop invalid hash packet")
packet.Put()
continue
}
if p.aead != nil {
packet.Data = p.DecodePreshared(packet.AdditionalData(), packet.Data)
if packet.Data == nil {
@@ -75,6 +70,11 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) {
continue
}
}
if !packet.IsVaildHash() {
logrus.Debugln("[listen] drop invalid hash packet")
packet.Put()
continue
}
switch packet.Proto {
case head.ProtoHello:
switch p.status {