mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-20 02:16:17 +08:00
feat(listen): add src check
This commit is contained in:
@@ -109,6 +109,11 @@ func (m *Me) listenthread(packet *head.Packet, addr *net.UDPAddr, index int, fin
|
|||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case p.IsToMe(packet.Dst):
|
case p.IsToMe(packet.Dst):
|
||||||
|
if !p.Accept(packet.Src) {
|
||||||
|
logrus.Warnln("[listen] @", index, "refused packet from", packet.Src.String()+":"+strconv.Itoa(int(packet.SrcPort)))
|
||||||
|
packet.Put()
|
||||||
|
return
|
||||||
|
}
|
||||||
addt := packet.AdditionalData()
|
addt := packet.AdditionalData()
|
||||||
var err error
|
var err error
|
||||||
packet.Data, err = p.Decode(packet.CipherIndex(), addt, packet.Data)
|
packet.Data, err = p.Decode(packet.CipherIndex(), addt, packet.Data)
|
||||||
|
|||||||
Reference in New Issue
Block a user