Add Proxy Protocol support

Closes #9
This commit is contained in:
Maddie Zhan
2020-08-19 17:02:37 +08:00
parent b76ebec8d0
commit a0a6db8597
7 changed files with 36 additions and 11 deletions

View File

@ -8,11 +8,12 @@ import (
)
type Config struct {
BindAddress string `mapstructure:"bind_address"`
Port string `mapstructure:"listen_port"`
ServerLat float64 `mapstructure:"server_lat"`
ServerLng float64 `mapstructure:"server_lng"`
IPInfoAPIKey string `mapstructure:"ipinfo_api_key"`
BindAddress string `mapstructure:"bind_address"`
Port string `mapstructure:"listen_port"`
ProxyProtocolPort string `mapstructure:"proxyprotocol_port"`
ServerLat float64 `mapstructure:"server_lat"`
ServerLng float64 `mapstructure:"server_lng"`
IPInfoAPIKey string `mapstructure:"ipinfo_api_key"`
StatsPassword string `mapstructure:"statistics_password"`
RedactIP bool `mapstructure:"redact_ip_addresses"`
@ -34,6 +35,7 @@ var (
func init() {
viper.SetDefault("listen_port", "8989")
viper.SetDefault("proxyprotocol_port", "0")
viper.SetDefault("download_chunks", 4)
viper.SetDefault("distance_unit", "K")
viper.SetDefault("enable_cors", false)