tracker/middleware/hooks.go

15 lines
478 B
Go
Raw Normal View History

2016-08-10 02:08:15 +02:00
package middleware
2016-08-05 07:47:04 +02:00
import (
2016-08-17 04:32:15 +02:00
"context"
2016-08-05 07:47:04 +02:00
2016-08-17 03:42:08 +02:00
"github.com/chihaya/chihaya/bittorrent"
2016-08-05 07:47:04 +02:00
)
// 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) (context.Context, error)
HandleScrape(context.Context, *bittorrent.ScrapeRequest, *bittorrent.ScrapeResponse) (context.Context, error)
}