diff --git a/config/config.go b/config/config.go index 9e91fbb..686dec4 100644 --- a/config/config.go +++ b/config/config.go @@ -35,9 +35,9 @@ type Config struct { // chihaya. type TrackerConfig struct { AnnounceInterval time.Duration `yaml:"announce"` - MinAnnounceInterval time.Duration `yaml:"minAnnounce"` - AnnounceMiddleware []string `yaml:"announceMiddleware"` - ScrapeMiddleware []string `yaml:"scrapeMiddleware"` + MinAnnounceInterval time.Duration `yaml:"min_announce"` + AnnounceMiddleware []string `yaml:"announce_middleware"` + ScrapeMiddleware []string `yaml:"scrape_middleware"` } // ServerConfig represents the configuration of the servers started by chihaya. diff --git a/config/example.yaml b/config/example.yaml index e5fa5c1..c2489f9 100644 --- a/config/example.yaml +++ b/config/example.yaml @@ -4,35 +4,35 @@ tracker: announce: 10m - minAnnounce: 5m - announceMiddleware: + min_announce: 5m + announce_middleware: - prometheus - - storeClientValidation - - storeCreateOnAnnounce - scrapeMiddleware: + - store_client_validation + - store_create_on_announce + scrape_middleware: - prometheus - - storeClientValidation + - store_client_validation servers: - name: store config: addr: localhost:6880 - requestTimeout: 10s - readTimeout: 10s - writeTimeout: 10s - clientStore: memory - ipStore: memory - peerStore: memory - peerStoreConfig: + request_timeout: 10s + read_timeout: 10s + write_timeout: 10s + client_store: memory + ip_store: memory + peer_store: memory + peer_store_config: gcAfter: 30m shards: 1 - name: http config: addr: localhost:6881 - requestTimeout: 10s - readTimeout: 10s - writeTimeout: 10s + request_timeout: 10s + read_timeout: 10s + write_timeout: 10s - name: udp config: diff --git a/server/store/middleware/ip/blacklist.go b/server/store/middleware/ip/blacklist.go index b73b02b..20e8aee 100644 --- a/server/store/middleware/ip/blacklist.go +++ b/server/store/middleware/ip/blacklist.go @@ -15,7 +15,7 @@ import ( ) func init() { - tracker.RegisterAnnounceMiddleware("IPBlacklist", blacklistAnnounceIP) + tracker.RegisterAnnounceMiddleware("ip_blacklist", blacklistAnnounceIP) } // ErrBlockedIP is returned by an announce middleware if any of the announcing diff --git a/server/store/middleware/ip/whitelist.go b/server/store/middleware/ip/whitelist.go index 7376768..2ad9808 100644 --- a/server/store/middleware/ip/whitelist.go +++ b/server/store/middleware/ip/whitelist.go @@ -14,7 +14,7 @@ import ( ) func init() { - tracker.RegisterAnnounceMiddleware("IPWhitelist", whitelistAnnounceIP) + tracker.RegisterAnnounceMiddleware("ip_whitelist", whitelistAnnounceIP) } // whitelistAnnounceIP provides a middleware that only allows IPs to announce diff --git a/server/store/store.go b/server/store/store.go index 4d8da45..9eef204 100644 --- a/server/store/store.go +++ b/server/store/store.go @@ -58,16 +58,16 @@ func constructor(srvcfg *config.ServerConfig, tkr *tracker.Tracker) (server.Serv type Config struct { Addr string `yaml:"addr"` - RequestTimeout time.Duration `yaml:"requestTimeout"` - ReadTimeout time.Duration `yaml:"readTimeout"` - WriteTimeout time.Duration `yaml:"writeTimeout"` - GCAfter time.Duration `yaml:"gcAfter"` - ClientStore string `yaml:"clientStore"` - ClientStoreConfig interface{} `yaml:"clienStoreConfig"` - PeerStore string `yaml:"peerStore"` - PeerStoreConfig interface{} `yaml:"peerStoreConfig"` - IPStore string `yaml:"ipStore"` - IPStoreConfig interface{} `yaml:"ipStoreConfig"` + RequestTimeout time.Duration `yaml:"request_timeout"` + ReadTimeout time.Duration `yaml:"read_timeout"` + WriteTimeout time.Duration `yaml:"write_timeout"` + GCAfter time.Duration `yaml:"gc_after"` + ClientStore string `yaml:"client_store"` + ClientStoreConfig interface{} `yaml:"client_store_config"` + PeerStore string `yaml:"peer_store"` + PeerStoreConfig interface{} `yaml:"peer_store_config"` + IPStore string `yaml:"ip_store"` + IPStoreConfig interface{} `yaml:"ip_store_config"` } func newConfig(srvcfg interface{}) (*Config, error) {