remove config package

This commit is contained in:
Jimmy Zelinskie
2016-03-02 20:18:55 -05:00
parent 47f85ec961
commit 0dfc26caea
16 changed files with 129 additions and 123 deletions
+1 -2
View File
@@ -6,7 +6,6 @@ package ip
import (
"github.com/chihaya/chihaya"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/server/store"
"github.com/chihaya/chihaya/tracker"
)
@@ -22,7 +21,7 @@ var ErrBlockedClient = tracker.ClientError("disallowed client")
// blacklistAnnounceClient provides a middleware that only allows Clients to
// announce that are not stored in a ClientStore.
func blacklistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandler {
return func(cfg *config.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
blacklisted, err := store.MustGetStore().FindClient(req.PeerID)
if err != nil {
+1 -2
View File
@@ -6,7 +6,6 @@ package ip
import (
"github.com/chihaya/chihaya"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/server/store"
"github.com/chihaya/chihaya/tracker"
)
@@ -18,7 +17,7 @@ func init() {
// whitelistAnnounceClient provides a middleware that only allows Clients to
// announce that are stored in a ClientStore.
func whitelistAnnounceClient(next tracker.AnnounceHandler) tracker.AnnounceHandler {
return func(cfg *config.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) error {
whitelisted, err := store.MustGetStore().FindClient(req.PeerID)
if err != nil {
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"net"
"github.com/chihaya/chihaya"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/server/store"
"github.com/chihaya/chihaya/tracker"
)
@@ -24,7 +23,7 @@ var ErrBlockedIP = tracker.ClientError("disallowed IP address")
// blacklistAnnounceIP provides a middleware that only allows IPs to announce
// that are not stored in an IPStore.
func blacklistAnnounceIP(next tracker.AnnounceHandler) tracker.AnnounceHandler {
return func(cfg *config.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) (err error) {
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) (err error) {
blacklisted := false
storage := store.MustGetStore()
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"net"
"github.com/chihaya/chihaya"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/server/store"
"github.com/chihaya/chihaya/tracker"
)
@@ -20,7 +19,7 @@ func init() {
// whitelistAnnounceIP provides a middleware that only allows IPs to announce
// that are stored in an IPStore.
func whitelistAnnounceIP(next tracker.AnnounceHandler) tracker.AnnounceHandler {
return func(cfg *config.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) (err error) {
return func(cfg *chihaya.TrackerConfig, req *chihaya.AnnounceRequest, resp *chihaya.AnnounceResponse) (err error) {
whitelisted := false
storage := store.MustGetStore()
+3 -3
View File
@@ -12,7 +12,7 @@ import (
"gopkg.in/yaml.v2"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya"
"github.com/chihaya/chihaya/server"
"github.com/chihaya/chihaya/tracker"
)
@@ -23,7 +23,7 @@ func init() {
server.Register("store", constructor)
}
func constructor(srvcfg *config.ServerConfig, tkr *tracker.Tracker) (server.Server, error) {
func constructor(srvcfg *chihaya.ServerConfig, tkr *tracker.Tracker) (server.Server, error) {
if theStore == nil {
cfg, err := newConfig(srvcfg)
if err != nil {
@@ -71,7 +71,7 @@ type Config struct {
IPStoreConfig interface{} `yaml:"ip_store_config"`
}
func newConfig(srvcfg *config.ServerConfig) (*Config, error) {
func newConfig(srvcfg *chihaya.ServerConfig) (*Config, error) {
bytes, err := yaml.Marshal(srvcfg.Config)
if err != nil {
return nil, err