config.yaml: camelCase to snake_case
This commit is contained in:
parent
6327938545
commit
50e5ff85af
5 changed files with 31 additions and 31 deletions
|
@ -35,9 +35,9 @@ type Config struct {
|
||||||
// chihaya.
|
// chihaya.
|
||||||
type TrackerConfig struct {
|
type TrackerConfig struct {
|
||||||
AnnounceInterval time.Duration `yaml:"announce"`
|
AnnounceInterval time.Duration `yaml:"announce"`
|
||||||
MinAnnounceInterval time.Duration `yaml:"minAnnounce"`
|
MinAnnounceInterval time.Duration `yaml:"min_announce"`
|
||||||
AnnounceMiddleware []string `yaml:"announceMiddleware"`
|
AnnounceMiddleware []string `yaml:"announce_middleware"`
|
||||||
ScrapeMiddleware []string `yaml:"scrapeMiddleware"`
|
ScrapeMiddleware []string `yaml:"scrape_middleware"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerConfig represents the configuration of the servers started by chihaya.
|
// ServerConfig represents the configuration of the servers started by chihaya.
|
||||||
|
|
|
@ -4,35 +4,35 @@
|
||||||
|
|
||||||
tracker:
|
tracker:
|
||||||
announce: 10m
|
announce: 10m
|
||||||
minAnnounce: 5m
|
min_announce: 5m
|
||||||
announceMiddleware:
|
announce_middleware:
|
||||||
- prometheus
|
- prometheus
|
||||||
- storeClientValidation
|
- store_client_validation
|
||||||
- storeCreateOnAnnounce
|
- store_create_on_announce
|
||||||
scrapeMiddleware:
|
scrape_middleware:
|
||||||
- prometheus
|
- prometheus
|
||||||
- storeClientValidation
|
- store_client_validation
|
||||||
|
|
||||||
servers:
|
servers:
|
||||||
- name: store
|
- name: store
|
||||||
config:
|
config:
|
||||||
addr: localhost:6880
|
addr: localhost:6880
|
||||||
requestTimeout: 10s
|
request_timeout: 10s
|
||||||
readTimeout: 10s
|
read_timeout: 10s
|
||||||
writeTimeout: 10s
|
write_timeout: 10s
|
||||||
clientStore: memory
|
client_store: memory
|
||||||
ipStore: memory
|
ip_store: memory
|
||||||
peerStore: memory
|
peer_store: memory
|
||||||
peerStoreConfig:
|
peer_store_config:
|
||||||
gcAfter: 30m
|
gcAfter: 30m
|
||||||
shards: 1
|
shards: 1
|
||||||
|
|
||||||
- name: http
|
- name: http
|
||||||
config:
|
config:
|
||||||
addr: localhost:6881
|
addr: localhost:6881
|
||||||
requestTimeout: 10s
|
request_timeout: 10s
|
||||||
readTimeout: 10s
|
read_timeout: 10s
|
||||||
writeTimeout: 10s
|
write_timeout: 10s
|
||||||
|
|
||||||
- name: udp
|
- name: udp
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
tracker.RegisterAnnounceMiddleware("IPBlacklist", blacklistAnnounceIP)
|
tracker.RegisterAnnounceMiddleware("ip_blacklist", blacklistAnnounceIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrBlockedIP is returned by an announce middleware if any of the announcing
|
// ErrBlockedIP is returned by an announce middleware if any of the announcing
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
tracker.RegisterAnnounceMiddleware("IPWhitelist", whitelistAnnounceIP)
|
tracker.RegisterAnnounceMiddleware("ip_whitelist", whitelistAnnounceIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
// whitelistAnnounceIP provides a middleware that only allows IPs to announce
|
// whitelistAnnounceIP provides a middleware that only allows IPs to announce
|
||||||
|
|
|
@ -58,16 +58,16 @@ func constructor(srvcfg *config.ServerConfig, tkr *tracker.Tracker) (server.Serv
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Addr string `yaml:"addr"`
|
Addr string `yaml:"addr"`
|
||||||
RequestTimeout time.Duration `yaml:"requestTimeout"`
|
RequestTimeout time.Duration `yaml:"request_timeout"`
|
||||||
ReadTimeout time.Duration `yaml:"readTimeout"`
|
ReadTimeout time.Duration `yaml:"read_timeout"`
|
||||||
WriteTimeout time.Duration `yaml:"writeTimeout"`
|
WriteTimeout time.Duration `yaml:"write_timeout"`
|
||||||
GCAfter time.Duration `yaml:"gcAfter"`
|
GCAfter time.Duration `yaml:"gc_after"`
|
||||||
ClientStore string `yaml:"clientStore"`
|
ClientStore string `yaml:"client_store"`
|
||||||
ClientStoreConfig interface{} `yaml:"clienStoreConfig"`
|
ClientStoreConfig interface{} `yaml:"client_store_config"`
|
||||||
PeerStore string `yaml:"peerStore"`
|
PeerStore string `yaml:"peer_store"`
|
||||||
PeerStoreConfig interface{} `yaml:"peerStoreConfig"`
|
PeerStoreConfig interface{} `yaml:"peer_store_config"`
|
||||||
IPStore string `yaml:"ipStore"`
|
IPStore string `yaml:"ip_store"`
|
||||||
IPStoreConfig interface{} `yaml:"ipStoreConfig"`
|
IPStoreConfig interface{} `yaml:"ip_store_config"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func newConfig(srvcfg interface{}) (*Config, error) {
|
func newConfig(srvcfg interface{}) (*Config, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue