rename back to chihaya
This commit is contained in:
parent
040a3294b1
commit
cc6614c474
17 changed files with 35 additions and 35 deletions
|
@ -14,10 +14,10 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
httpfrontend "github.com/jzelinskie/trakr/frontend/http"
|
httpfrontend "github.com/chihaya/chihaya/frontend/http"
|
||||||
udpfrontend "github.com/jzelinskie/trakr/frontend/udp"
|
udpfrontend "github.com/chihaya/chihaya/frontend/udp"
|
||||||
"github.com/jzelinskie/trakr/middleware"
|
"github.com/chihaya/chihaya/middleware"
|
||||||
"github.com/jzelinskie/trakr/storage/memory"
|
"github.com/chihaya/chihaya/storage/memory"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigFile struct {
|
type ConfigFile struct {
|
||||||
|
@ -27,7 +27,7 @@ type ConfigFile struct {
|
||||||
HTTPConfig httpfrontend.Config `yaml:"http"`
|
HTTPConfig httpfrontend.Config `yaml:"http"`
|
||||||
UDPConfig udpfrontend.Config `yaml:"udp"`
|
UDPConfig udpfrontend.Config `yaml:"udp"`
|
||||||
Storage memory.Config `yaml:"storage"`
|
Storage memory.Config `yaml:"storage"`
|
||||||
} `yaml:"trakr"`
|
} `yaml:"chihaya"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseConfigFile returns a new ConfigFile given the path to a YAML
|
// ParseConfigFile returns a new ConfigFile given the path to a YAML
|
||||||
|
@ -64,7 +64,7 @@ func main() {
|
||||||
var cpuProfilePath string
|
var cpuProfilePath string
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "trakr",
|
Use: "chihaya",
|
||||||
Short: "BitTorrent Tracker",
|
Short: "BitTorrent Tracker",
|
||||||
Long: "A customizible, multi-protocol BitTorrent Tracker",
|
Long: "A customizible, multi-protocol BitTorrent Tracker",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
@ -173,7 +173,7 @@ func main() {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rootCmd.Flags().StringVar(&configFilePath, "config", "/etc/trakr.yaml", "location of configuration file")
|
rootCmd.Flags().StringVar(&configFilePath, "config", "/etc/chihaya.yaml", "location of configuration file")
|
||||||
rootCmd.Flags().StringVarP(&cpuProfilePath, "cpuprofile", "", "", "location to save a CPU profile")
|
rootCmd.Flags().StringVarP(&cpuProfilePath, "cpuprofile", "", "", "location to save a CPU profile")
|
||||||
|
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
|
@ -1,4 +1,4 @@
|
||||||
trakr:
|
chihaya:
|
||||||
announce_interval: 15m
|
announce_interval: 15m
|
||||||
prometheus_addr: localhost:6880
|
prometheus_addr: localhost:6880
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package frontend
|
||||||
import (
|
import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TrackerLogic is the interface used by a frontend in order to: (1) generate a
|
// TrackerLogic is the interface used by a frontend in order to: (1) generate a
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/tylerb/graceful"
|
"github.com/tylerb/graceful"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/frontend"
|
"github.com/chihaya/chihaya/frontend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -22,7 +22,7 @@ func init() {
|
||||||
|
|
||||||
var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
||||||
prometheus.HistogramOpts{
|
prometheus.HistogramOpts{
|
||||||
Name: "trakr_http_response_duration_milliseconds",
|
Name: "chihaya_http_response_duration_milliseconds",
|
||||||
Help: "The duration of time it takes to receive and write a response to an API request",
|
Help: "The duration of time it takes to receive and write a response to an API request",
|
||||||
Buckets: prometheus.ExponentialBuckets(9.375, 2, 10),
|
Buckets: prometheus.ExponentialBuckets(9.375, 2, 10),
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ParseAnnounce parses an bittorrent.AnnounceRequest from an http.Request.
|
// ParseAnnounce parses an bittorrent.AnnounceRequest from an http.Request.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrKeyNotFound is returned when a provided key has no value associated with
|
// ErrKeyNotFound is returned when a provided key has no value associated with
|
||||||
|
|
|
@ -3,8 +3,8 @@ package http
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
"github.com/jzelinskie/trakr/frontend/http/bencode"
|
"github.com/chihaya/chihaya/frontend/http/bencode"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteError communicates an error to a BitTorrent client over HTTP.
|
// WriteError communicates an error to a BitTorrent client over HTTP.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWriteError(t *testing.T) {
|
func TestWriteError(t *testing.T) {
|
||||||
|
|
|
@ -13,9 +13,9 @@ import (
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
"github.com/jzelinskie/trakr/frontend"
|
"github.com/chihaya/chihaya/frontend"
|
||||||
"github.com/jzelinskie/trakr/frontend/udp/bytepool"
|
"github.com/chihaya/chihaya/frontend/udp/bytepool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -25,7 +25,7 @@ func init() {
|
||||||
|
|
||||||
var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
||||||
prometheus.HistogramOpts{
|
prometheus.HistogramOpts{
|
||||||
Name: "trakr_udp_response_duration_milliseconds",
|
Name: "chihaya_udp_response_duration_milliseconds",
|
||||||
Help: "The duration of time it takes to receive and write a response to an API request",
|
Help: "The duration of time it takes to receive and write a response to an API request",
|
||||||
Buckets: prometheus.ExponentialBuckets(9.375, 2, 10),
|
Buckets: prometheus.ExponentialBuckets(9.375, 2, 10),
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -125,7 +125,7 @@ func handleOptionalParameters(packet []byte) (params bittorrent.Params, err erro
|
||||||
return params, errMalformedPacket
|
return params, errMalformedPacket
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jzelinskie): Actually parse the URL Data as described in BEP 41
|
// TODO(chihaya): Actually parse the URL Data as described in BEP 41
|
||||||
// into something that fulfills the bittorrent.Params interface.
|
// into something that fulfills the bittorrent.Params interface.
|
||||||
|
|
||||||
optionStartIndex += 1 + length
|
optionStartIndex += 1 + length
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteError writes the failure reason as a null-terminated string.
|
// WriteError writes the failure reason as a null-terminated string.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package middleware
|
||||||
import (
|
import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Hook abstracts the concept of anything that needs to interact with a
|
// Hook abstracts the concept of anything that needs to interact with a
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
"github.com/jzelinskie/trakr/frontend"
|
"github.com/chihaya/chihaya/frontend"
|
||||||
"github.com/jzelinskie/trakr/storage"
|
"github.com/chihaya/chihaya/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
@ -78,7 +78,7 @@ func (l *Logic) HandleAnnounce(ctx context.Context, req *bittorrent.AnnounceRequ
|
||||||
func (l *Logic) AfterAnnounce(ctx context.Context, req *bittorrent.AnnounceRequest, resp *bittorrent.AnnounceResponse) {
|
func (l *Logic) AfterAnnounce(ctx context.Context, req *bittorrent.AnnounceRequest, resp *bittorrent.AnnounceResponse) {
|
||||||
for _, h := range l.announcePostHooks {
|
for _, h := range l.announcePostHooks {
|
||||||
if err := h.HandleAnnounce(ctx, req, resp); err != nil {
|
if err := h.HandleAnnounce(ctx, req, resp); err != nil {
|
||||||
log.Println("trakr: post-announce hooks failed:", err.Error())
|
log.Println("chihaya: post-announce hooks failed:", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ func (l *Logic) HandleScrape(ctx context.Context, req *bittorrent.ScrapeRequest)
|
||||||
func (l *Logic) AfterScrape(ctx context.Context, req *bittorrent.ScrapeRequest, resp *bittorrent.ScrapeResponse) {
|
func (l *Logic) AfterScrape(ctx context.Context, req *bittorrent.ScrapeRequest, resp *bittorrent.ScrapeResponse) {
|
||||||
for _, h := range l.scrapePostHooks {
|
for _, h := range l.scrapePostHooks {
|
||||||
if err := h.HandleScrape(ctx, req, resp); err != nil {
|
if err := h.HandleScrape(ctx, req, resp); err != nil {
|
||||||
log.Println("trakr: post-scrape hooks failed:", err.Error())
|
log.Println("chihaya: post-scrape hooks failed:", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
"github.com/jzelinskie/trakr/storage"
|
"github.com/chihaya/chihaya/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config holds the configuration of a memory PeerStore.
|
// Config holds the configuration of a memory PeerStore.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package memory
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
s "github.com/jzelinskie/trakr/storage"
|
s "github.com/chihaya/chihaya/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createNew() s.PeerStore {
|
func createNew() s.PeerStore {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
"github.com/jzelinskie/trakr/stopper"
|
"github.com/chihaya/chihaya/stopper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrResourceDoesNotExist is the error returned by all delete methods in the
|
// ErrResourceDoesNotExist is the error returned by all delete methods in the
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/jzelinskie/trakr/bittorrent"
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
type benchData struct {
|
type benchData struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue