mirror of
https://github.com/ergochat/ergo.git
synced 2025-02-01 23:24:09 +01:00
rename some variables for clarity
This commit is contained in:
parent
50783d5276
commit
7432ef07a7
@ -194,7 +194,7 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
|
|||||||
var isBanned bool
|
var isBanned bool
|
||||||
var banMsg string
|
var banMsg string
|
||||||
var realIP net.IP
|
var realIP net.IP
|
||||||
if conn.Config.IsTor {
|
if conn.Config.Tor {
|
||||||
realIP = utils.IPv4LoopbackAddress
|
realIP = utils.IPv4LoopbackAddress
|
||||||
isBanned, banMsg = server.checkTorLimits()
|
isBanned, banMsg = server.checkTorLimits()
|
||||||
} else {
|
} else {
|
||||||
@ -221,8 +221,8 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
|
|||||||
atime: now,
|
atime: now,
|
||||||
channels: make(ChannelSet),
|
channels: make(ChannelSet),
|
||||||
ctime: now,
|
ctime: now,
|
||||||
isSTSOnly: conn.Config.IsSTSOnly,
|
isSTSOnly: conn.Config.STSOnly,
|
||||||
isTor: conn.Config.IsTor,
|
isTor: conn.Config.Tor,
|
||||||
languages: server.Languages().Default(),
|
languages: server.Languages().Default(),
|
||||||
loginThrottle: connection_limits.GenericThrottle{
|
loginThrottle: connection_limits.GenericThrottle{
|
||||||
Duration: config.Accounts.LoginThrottling.Duration,
|
Duration: config.Accounts.LoginThrottling.Duration,
|
||||||
@ -254,7 +254,7 @@ func (server *Server) RunClient(conn clientConn, proxyLine string) {
|
|||||||
client.certfp, _ = socket.CertFP()
|
client.certfp, _ = socket.CertFP()
|
||||||
}
|
}
|
||||||
|
|
||||||
if conn.Config.IsTor {
|
if conn.Config.Tor {
|
||||||
client.SetMode(modes.TLS, true)
|
client.SetMode(modes.TLS, true)
|
||||||
// cover up details of the tor proxying infrastructure (not a user privacy concern,
|
// cover up details of the tor proxying infrastructure (not a user privacy concern,
|
||||||
// but a hardening measure):
|
// but a hardening measure):
|
||||||
|
@ -55,9 +55,9 @@ type listenerConfigBlock struct {
|
|||||||
// in particular whether it has TLS or Tor (or both) enabled.
|
// in particular whether it has TLS or Tor (or both) enabled.
|
||||||
type listenerConfig struct {
|
type listenerConfig struct {
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config
|
||||||
IsTor bool
|
Tor bool
|
||||||
IsSTSOnly bool
|
STSOnly bool
|
||||||
IsTLSProxy bool
|
ProxyBeforeTLS bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccountConfig struct {
|
type AccountConfig struct {
|
||||||
@ -520,9 +520,9 @@ func (conf *Config) prepareListeners() (err error) {
|
|||||||
if 0 < len(conf.Server.Listeners) {
|
if 0 < len(conf.Server.Listeners) {
|
||||||
for addr, block := range conf.Server.Listeners {
|
for addr, block := range conf.Server.Listeners {
|
||||||
var lconf listenerConfig
|
var lconf listenerConfig
|
||||||
lconf.IsTor = block.Tor
|
lconf.Tor = block.Tor
|
||||||
lconf.IsSTSOnly = block.STSOnly
|
lconf.STSOnly = block.STSOnly
|
||||||
if lconf.IsSTSOnly && !conf.Server.STS.Enabled {
|
if lconf.STSOnly && !conf.Server.STS.Enabled {
|
||||||
return fmt.Errorf("%s is configured as a STS-only listener, but STS is disabled", addr)
|
return fmt.Errorf("%s is configured as a STS-only listener, but STS is disabled", addr)
|
||||||
}
|
}
|
||||||
if block.TLS.Cert != "" {
|
if block.TLS.Cert != "" {
|
||||||
@ -531,7 +531,7 @@ func (conf *Config) prepareListeners() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
lconf.TLSConfig = tlsConfig
|
lconf.TLSConfig = tlsConfig
|
||||||
lconf.IsTLSProxy = block.TLS.Proxy
|
lconf.ProxyBeforeTLS = block.TLS.Proxy
|
||||||
}
|
}
|
||||||
listeners[addr] = lconf
|
listeners[addr] = lconf
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ func (conf *Config) prepareListeners() (err error) {
|
|||||||
}
|
}
|
||||||
for _, addr := range conf.Server.Listen {
|
for _, addr := range conf.Server.Listen {
|
||||||
var lconf listenerConfig
|
var lconf listenerConfig
|
||||||
lconf.IsTor = torListeners[addr]
|
lconf.Tor = torListeners[addr]
|
||||||
tlsListenConf, ok := conf.Server.TLSListeners[addr]
|
tlsListenConf, ok := conf.Server.TLSListeners[addr]
|
||||||
if ok {
|
if ok {
|
||||||
tlsConfig, err := loadTlsConfig(tlsListenConf)
|
tlsConfig, err := loadTlsConfig(tlsListenConf)
|
||||||
|
@ -308,7 +308,7 @@ func (server *Server) createListener(addr string, conf listenerConfig, bindMode
|
|||||||
return
|
return
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
var proxyLine string
|
var proxyLine string
|
||||||
if conf.IsTLSProxy {
|
if conf.ProxyBeforeTLS {
|
||||||
proxyLine = readRawProxyLine(conn)
|
proxyLine = readRawProxyLine(conn)
|
||||||
if proxyLine == "" {
|
if proxyLine == "" {
|
||||||
server.logger.Error("internal", "bad TLS-proxy line from", addr)
|
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) {
|
func (server *Server) setupListeners(config *Config) (err error) {
|
||||||
logListener := func(addr string, config listenerConfig) {
|
logListener := func(addr string, config listenerConfig) {
|
||||||
server.logger.Info("listeners",
|
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 := ""
|
publicPlaintextListener := ""
|
||||||
// create new listeners that were not previously configured
|
// create new listeners that were not previously configured
|
||||||
for newAddr, newConfig := range config.Server.trueListeners {
|
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
|
publicPlaintextListener = newAddr
|
||||||
}
|
}
|
||||||
_, exists := server.listeners[newAddr]
|
_, exists := server.listeners[newAddr]
|
||||||
|
Loading…
Reference in New Issue
Block a user