From 07cc413399c160dc64ec066872808770e1b8a014 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 16 Aug 2016 22:37:29 -0400 Subject: [PATCH] clientwhitelist: fix compilation issues --- middleware/clientwhitelist/clientwhitelist.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/middleware/clientwhitelist/clientwhitelist.go b/middleware/clientwhitelist/clientwhitelist.go index 1e06ac3..f7aefd4 100644 --- a/middleware/clientwhitelist/clientwhitelist.go +++ b/middleware/clientwhitelist/clientwhitelist.go @@ -13,11 +13,11 @@ import ( // begin with an approved prefix. var ClientUnapproved = bittorrent.ClientError("unapproved client") -type Hook struct { +type hook struct { approved map[bittorrent.ClientID]struct{} } -func NewHook(approved []string) { +func NewHook(approved []string) middleware.Hook { h := &hook{ approved: make(map[bittorrent.ClientID]struct{}), } @@ -29,9 +29,7 @@ func NewHook(approved []string) { return h } -var _ middleware.Hook = &Hook{} - -func (h *Hook) HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bittorrent.AnnounceResponse) error { +func (h *hook) HandleAnnounce(ctx context.Context, req *bittorrent.AnnounceRequest, resp *bittorrent.AnnounceResponse) error { if _, found := h.approved[bittorrent.NewClientID(req.Peer.ID)]; !found { return ClientUnapproved } @@ -39,6 +37,6 @@ func (h *Hook) HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bit return nil } -func (h *Hook) HandleScrape(context.Context, *bittorrent.ScrapeRequest, *bittorrent.ScrapeResponse) error { +func (h *hook) HandleScrape(ctx context.Context, req *bittorrent.ScrapeRequest, resp *bittorrent.ScrapeResponse) error { return nil }