http: add option for legacy PHP URLs
This commit is contained in:
parent
395e59aef3
commit
2f58e98832
2 changed files with 19 additions and 0 deletions
|
@ -36,6 +36,16 @@ chihaya:
|
|||
# Disabling this should increase performance/decrease load.
|
||||
enable_request_timing: false
|
||||
|
||||
# Whether to listen on /announce.php and /scrape.php in addition to their
|
||||
# non-.php counterparts.
|
||||
# This is an option for compatibility with (very) old clients or otherwise
|
||||
# outdated systems.
|
||||
# This might be useful to retracker.local users, for more information see
|
||||
# http://rutracker.wiki/Оптимизация_обмена_битторрент_траффиком_в_локальных_сетях
|
||||
# and
|
||||
# http://rutracker.wiki/Retracker.local
|
||||
enable_legacy_php_urls: false
|
||||
|
||||
# When enabled, the IP address used to connect to the tracker will not
|
||||
# override the value clients advertise as their IP address.
|
||||
allow_ip_spoofing: false
|
||||
|
|
|
@ -64,6 +64,7 @@ type Config struct {
|
|||
WriteTimeout time.Duration `yaml:"write_timeout"`
|
||||
TLSCertPath string `yaml:"tls_cert_path"`
|
||||
TLSKeyPath string `yaml:"tls_key_path"`
|
||||
EnableLegacyPHPURLs bool `yaml:"enable_legacy_php_urls"`
|
||||
EnableRequestTiming bool `yaml:"enable_request_timing"`
|
||||
ParseOptions `yaml:",inline"`
|
||||
}
|
||||
|
@ -76,6 +77,7 @@ func (cfg Config) LogFields() log.Fields {
|
|||
"writeTimeout": cfg.WriteTimeout,
|
||||
"tlsCertPath": cfg.TLSCertPath,
|
||||
"tlsKeyPath": cfg.TLSKeyPath,
|
||||
"enableLegacyPHPURLs": cfg.EnableLegacyPHPURLs,
|
||||
"enableRequestTiming": cfg.EnableRequestTiming,
|
||||
"allowIPSpoofing": cfg.AllowIPSpoofing,
|
||||
"realIPHeader": cfg.RealIPHeader,
|
||||
|
@ -177,6 +179,13 @@ func (f *Frontend) handler() http.Handler {
|
|||
router := httprouter.New()
|
||||
router.GET("/announce", f.announceRoute)
|
||||
router.GET("/scrape", f.scrapeRoute)
|
||||
|
||||
if f.EnableLegacyPHPURLs {
|
||||
log.Info("http: enabling legacy PHP URLs")
|
||||
router.GET("/announce.php", f.announceRoute)
|
||||
router.GET("/scrape.php", f.scrapeRoute)
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue