mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-29 23:30:37 +08:00
fix(listen): preshard key decode
This commit is contained in:
@@ -62,11 +62,6 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) {
|
|||||||
switch {
|
switch {
|
||||||
case p.IsToMe(packet.Dst):
|
case p.IsToMe(packet.Dst):
|
||||||
packet.Data = p.Decode(uint8(packet.TeaTypeDataSZ>>28), packet.Data)
|
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 {
|
if p.aead != nil {
|
||||||
packet.Data = p.DecodePreshared(packet.AdditionalData(), packet.Data)
|
packet.Data = p.DecodePreshared(packet.AdditionalData(), packet.Data)
|
||||||
if packet.Data == nil {
|
if packet.Data == nil {
|
||||||
@@ -75,6 +70,11 @@ func (m *Me) listenthread(conn *net.UDPConn, mu *sync.Mutex) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !packet.IsVaildHash() {
|
||||||
|
logrus.Debugln("[listen] drop invalid hash packet")
|
||||||
|
packet.Put()
|
||||||
|
continue
|
||||||
|
}
|
||||||
switch packet.Proto {
|
switch packet.Proto {
|
||||||
case head.ProtoHello:
|
case head.ProtoHello:
|
||||||
switch p.status {
|
switch p.status {
|
||||||
|
|||||||
Reference in New Issue
Block a user