mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-26 09:28:10 -07:00
make infohash and peerID byte arrays (#169)
This commit is contained in:
committed by
Jimmy Zelinskie
parent
a081e5195b
commit
7f16c55d81
@@ -23,7 +23,7 @@ var ErrBlacklistedClient = tracker.ClientError("client blacklisted")
|
||||
// announce that are not stored in the StringStore.
|
||||
func blacklistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandler {
|
||||
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
|
||||
blacklisted, err := store.MustGetStore().HasString(PrefixClient + clientid.New(string(req.PeerID)))
|
||||
blacklisted, err := store.MustGetStore().HasString(PrefixClient + clientid.New(string(req.PeerID[:])))
|
||||
if err != nil {
|
||||
return err
|
||||
} else if blacklisted {
|
||||
|
||||
@@ -26,7 +26,7 @@ var ErrNotWhitelistedClient = tracker.ClientError("client not whitelisted")
|
||||
// announce that are stored in the StringStore.
|
||||
func whitelistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandler {
|
||||
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
|
||||
whitelisted, err := store.MustGetStore().HasString(PrefixClient + clientid.New(string(req.PeerID)))
|
||||
whitelisted, err := store.MustGetStore().HasString(PrefixClient + clientid.New(string(req.PeerID[:])))
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !whitelisted {
|
||||
|
||||
Reference in New Issue
Block a user