middleware/hooks: preserve response changes

This commit is contained in:
Victor Shyba 2022-04-13 17:13:32 -03:00
parent acf2a5a75d
commit 7d9731d68a

View file

@ -124,9 +124,9 @@ func (h *responseHook) appendPeers(req *bittorrent.AnnounceRequest, resp *bittor
switch req.IP.AddressFamily {
case bittorrent.IPv4:
resp.IPv4Peers = peers
resp.IPv4Peers = append(resp.IPv4Peers, peers...)
case bittorrent.IPv6:
resp.IPv6Peers = peers
resp.IPv6Peers = append(resp.IPv6Peers, peers...)
default:
panic("attempted to append peer that is neither IPv4 nor IPv6")
}