3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

rename some variables for clarity

This commit is contained in:
Shivaram Lingamneni 2019-11-20 17:43:40 -05:00
parent 50783d5276
commit 7432ef07a7
3 changed files with 16 additions and 16 deletions

View File

@ -194,7 +194,7 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
var isBanned bool
var banMsg string
var realIP net.IP
if conn.Config.IsTor {
if conn.Config.Tor {
realIP = utils.IPv4LoopbackAddress
isBanned, banMsg = server.checkTorLimits()
} else {
@ -221,8 +221,8 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
atime: now,
channels: make(ChannelSet),
ctime: now,
isSTSOnly: conn.Config.IsSTSOnly,
isTor: conn.Config.IsTor,
isSTSOnly: conn.Config.STSOnly,
isTor: conn.Config.Tor,
languages: server.Languages().Default(),
loginThrottle: connection_limits.GenericThrottle{
Duration: config.Accounts.LoginThrottling.Duration,
@ -254,7 +254,7 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
client.certfp, _ = socket.CertFP()
}
if conn.Config.IsTor {
if conn.Config.Tor {
client.SetMode(modes.TLS, true)
// cover up details of the tor proxying infrastructure (not a user privacy concern,
// but a hardening measure):

View File

@ -54,10 +54,10 @@ type listenerConfigBlock struct {
// listenerConfig is the config governing a particular listener (bound address),
// in particular whether it has TLS or Tor (or both) enabled.
type listenerConfig struct {
TLSConfig *tls.Config
IsTor bool
IsSTSOnly bool
IsTLSProxy bool
TLSConfig *tls.Config
Tor bool
STSOnly bool
ProxyBeforeTLS bool
}
type AccountConfig struct {
@ -520,9 +520,9 @@ func (conf *Config) prepareListeners() (err error) {
if 0 < len(conf.Server.Listeners) {
for addr, block := range conf.Server.Listeners {
var lconf listenerConfig
lconf.IsTor = block.Tor
lconf.IsSTSOnly = block.STSOnly
if lconf.IsSTSOnly && !conf.Server.STS.Enabled {
lconf.Tor = block.Tor
lconf.STSOnly = block.STSOnly
if lconf.STSOnly && !conf.Server.STS.Enabled {
return fmt.Errorf("%s is configured as a STS-only listener, but STS is disabled", addr)
}
if block.TLS.Cert != "" {
@ -531,7 +531,7 @@ func (conf *Config) prepareListeners() (err error) {
return err
}
lconf.TLSConfig = tlsConfig
lconf.IsTLSProxy = block.TLS.Proxy
lconf.ProxyBeforeTLS = block.TLS.Proxy
}
listeners[addr] = lconf
}
@ -544,7 +544,7 @@ func (conf *Config) prepareListeners() (err error) {
}
for _, addr := range conf.Server.Listen {
var lconf listenerConfig
lconf.IsTor = torListeners[addr]
lconf.Tor = torListeners[addr]
tlsListenConf, ok := conf.Server.TLSListeners[addr]
if ok {
tlsConfig, err := loadTlsConfig(tlsListenConf)

View File

@ -308,7 +308,7 @@ func (server *Server) createListener(addr string, conf listenerConfig, bindMode
return
} else if err == nil {
var proxyLine string
if conf.IsTLSProxy {
if conf.ProxyBeforeTLS {
proxyLine = readRawProxyLine(conn)
if proxyLine == "" {
server.logger.Error("internal", "bad TLS-proxy line from", addr)
@ -877,7 +877,7 @@ func (server *Server) loadDatastore(config *Config) error {
func (server *Server) setupListeners(config *Config) (err error) {
logListener := func(addr string, config listenerConfig) {
server.logger.Info("listeners",
fmt.Sprintf("now listening on %s, tls=%t, tlsproxy=%t, tor=%t.", addr, (config.TLSConfig != nil), config.IsTLSProxy, config.IsTor),
fmt.Sprintf("now listening on %s, tls=%t, tlsproxy=%t, tor=%t.", addr, (config.TLSConfig != nil), config.ProxyBeforeTLS, config.Tor),
)
}
@ -904,7 +904,7 @@ func (server *Server) setupListeners(config *Config) (err error) {
publicPlaintextListener := ""
// create new listeners that were not previously configured
for newAddr, newConfig := range config.Server.trueListeners {
if strings.HasPrefix(newAddr, ":") && !newConfig.IsTor && !newConfig.IsSTSOnly && newConfig.TLSConfig == nil {
if strings.HasPrefix(newAddr, ":") && !newConfig.Tor && !newConfig.STSOnly && newConfig.TLSConfig == nil {
publicPlaintextListener = newAddr
}
_, exists := server.listeners[newAddr]