From d139335111adc4ca7d0c810933e116e97939720b Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Tue, 5 Apr 2016 01:10:07 +0100 Subject: [PATCH] middleware/client: be more specific with error messages contributes to #160 --- server/store/middleware/client/blacklist.go | 8 ++++---- server/store/middleware/client/whitelist.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/store/middleware/client/blacklist.go b/server/store/middleware/client/blacklist.go index a5bbfd5..ed675f9 100644 --- a/server/store/middleware/client/blacklist.go +++ b/server/store/middleware/client/blacklist.go @@ -15,9 +15,9 @@ func init() { tracker.RegisterAnnounceMiddleware("client_blacklist", blacklistAnnounceClient) } -// ErrBlockedClient is returned by an announce middleware if the announcing -// Client is disallowed. -var ErrBlockedClient = tracker.ClientError("disallowed client") +// ErrBlacklistedClient is returned by an announce middleware if the announcing +// Client is blacklisted. +var ErrBlacklistedClient = tracker.ClientError("client blacklisted") // blacklistAnnounceClient provides a middleware that only allows Clients to // announce that are not stored in the StringStore. @@ -27,7 +27,7 @@ func blacklistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandl if err != nil { return err } else if blacklisted { - return ErrBlockedClient + return ErrBlacklistedClient } return next(cfg, req, resp) } diff --git a/server/store/middleware/client/whitelist.go b/server/store/middleware/client/whitelist.go index 51b48e5..980f6cd 100644 --- a/server/store/middleware/client/whitelist.go +++ b/server/store/middleware/client/whitelist.go @@ -30,7 +30,7 @@ func whitelistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandl if err != nil { return err } else if !whitelisted { - return ErrBlockedClient + return ErrNotWhitelistedClient } return next(cfg, req, resp) }