Skip to content

Commit

Permalink
Try fix a bug that IPv6 addr won't be banned (ShadowBan). (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paindar authored Sep 19, 2024
1 parent d2c50de commit 8863e95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client_qBittorrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ func qB_SubmitShadowBanPeer(blockPeerMap map[string]BlockPeerInfoStruct) bool {
if port <= 0 || port > 65535 {
port = 1 // Seems qBittorrent will ignore the invalid port number, so we just set it to 1.
}
shadowBanIPPortsList = append(shadowBanIPPortsList, peerIP + ":" + strconv.Itoa(port))
if IsIPv6(peerIP) {
shadowBanIPPortsList = append(shadowBanIPPortsList, "[" + peerIP + "]:" + strconv.Itoa(port))
} else {
shadowBanIPPortsList = append(shadowBanIPPortsList, peerIP + ":" + strconv.Itoa(port))
}
}
}

Expand Down

0 comments on commit 8863e95

Please sign in to comment.