clientwhitelist: fix compilation issues
This commit is contained in:
parent
fc13031d96
commit
07cc413399
1 changed files with 4 additions and 6 deletions
|
@ -13,11 +13,11 @@ import (
|
||||||
// begin with an approved prefix.
|
// begin with an approved prefix.
|
||||||
var ClientUnapproved = bittorrent.ClientError("unapproved client")
|
var ClientUnapproved = bittorrent.ClientError("unapproved client")
|
||||||
|
|
||||||
type Hook struct {
|
type hook struct {
|
||||||
approved map[bittorrent.ClientID]struct{}
|
approved map[bittorrent.ClientID]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHook(approved []string) {
|
func NewHook(approved []string) middleware.Hook {
|
||||||
h := &hook{
|
h := &hook{
|
||||||
approved: make(map[bittorrent.ClientID]struct{}),
|
approved: make(map[bittorrent.ClientID]struct{}),
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,7 @@ func NewHook(approved []string) {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ middleware.Hook = &Hook{}
|
func (h *hook) HandleAnnounce(ctx context.Context, req *bittorrent.AnnounceRequest, resp *bittorrent.AnnounceResponse) error {
|
||||||
|
|
||||||
func (h *Hook) HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bittorrent.AnnounceResponse) error {
|
|
||||||
if _, found := h.approved[bittorrent.NewClientID(req.Peer.ID)]; !found {
|
if _, found := h.approved[bittorrent.NewClientID(req.Peer.ID)]; !found {
|
||||||
return ClientUnapproved
|
return ClientUnapproved
|
||||||
}
|
}
|
||||||
|
@ -39,6 +37,6 @@ func (h *Hook) HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bit
|
||||||
return nil
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue