mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-05 16:00:28 +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 {
|
||||
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()
|
||||
var err error
|
||||
packet.Data, err = p.Decode(packet.CipherIndex(), addt, packet.Data)
|
||||
|
||||
Reference in New Issue
Block a user