s/backend/middleware
This commit is contained in:
parent
c7b17d3195
commit
c9fe95b103
7 changed files with 142 additions and 169 deletions
middleware
24
middleware/hooks.go
Normal file
24
middleware/hooks.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/jzelinskie/trakr/bittorrent"
|
||||
)
|
||||
|
||||
// Hook abstracts the concept of anything that needs to interact with a
|
||||
// BitTorrent client's request and response to a BitTorrent tracker.
|
||||
type Hook interface {
|
||||
HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bittorrent.AnnounceResponse) error
|
||||
HandleScrape(context.Context, *bittorrent.ScrapeRequest, *bittorrent.ScrapeResponse) error
|
||||
}
|
||||
|
||||
type nopHook struct{}
|
||||
|
||||
func (nopHook) HandleAnnounce(context.Context, *bittorrent.AnnounceRequest, *bittorrent.AnnounceResponse) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nopHook) HandleScrape(context.Context, *bittorrent.ScrapeRequest, *bittorrent.ScrapeResponse) error {
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue