forked from External/ergo
add support for tor (#369)
This commit is contained in:
parent
d43ce07b66
commit
b0f89062fa
10 changed files with 307 additions and 77 deletions
|
|
@ -251,6 +251,15 @@ type FakelagConfig struct {
|
|||
Cooldown time.Duration
|
||||
}
|
||||
|
||||
type TorListenersConfig struct {
|
||||
Listeners []string
|
||||
RequireSasl bool `yaml:"require-sasl"`
|
||||
Vhost string
|
||||
MaxConnections int `yaml:"max-connections"`
|
||||
ThrottleDuration time.Duration `yaml:"throttle-duration"`
|
||||
MaxConnectionsPerDuration int `yaml:"max-connections-per-duration"`
|
||||
}
|
||||
|
||||
// Config defines the overall configuration.
|
||||
type Config struct {
|
||||
Network struct {
|
||||
|
|
@ -265,6 +274,7 @@ type Config struct {
|
|||
Listen []string
|
||||
UnixBindMode os.FileMode `yaml:"unix-bind-mode"`
|
||||
TLSListeners map[string]*TLSListenConfig `yaml:"tls-listeners"`
|
||||
TorListeners TorListenersConfig `yaml:"tor-listeners"`
|
||||
STS STSConfig
|
||||
CheckIdent bool `yaml:"check-ident"`
|
||||
MOTD string
|
||||
|
|
@ -806,5 +816,18 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||
config.History.ClientLength = 0
|
||||
}
|
||||
|
||||
for _, listenAddress := range config.Server.TorListeners.Listeners {
|
||||
found := false
|
||||
for _, configuredListener := range config.Server.Listen {
|
||||
if listenAddress == configuredListener {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return nil, fmt.Errorf("%s is configured as a Tor listener, but is not in server.listen", listenAddress)
|
||||
}
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue