1
0
Fork 0
forked from External/ergo

refactor listener config loading

This commit is contained in:
Shivaram Lingamneni 2019-06-17 22:21:37 -04:00
parent 0a67963f43
commit 5d0b8390e9
3 changed files with 82 additions and 105 deletions

View file

@ -193,7 +193,7 @@ func (server *Server) RunClient(conn clientConn) {
var isBanned bool
var banMsg string
var realIP net.IP
if conn.IsTor {
if conn.Config.IsTor {
realIP = utils.IPv4LoopbackAddress
isBanned, banMsg = server.checkTorLimits()
} else {
@ -220,7 +220,7 @@ func (server *Server) RunClient(conn clientConn) {
atime: now,
channels: make(ChannelSet),
ctime: now,
isTor: conn.IsTor,
isTor: conn.Config.IsTor,
languages: server.Languages().Default(),
loginThrottle: connection_limits.GenericThrottle{
Duration: config.Accounts.LoginThrottling.Duration,
@ -246,13 +246,13 @@ func (server *Server) RunClient(conn clientConn) {
session.SetMaxlenRest()
client.sessions = []*Session{session}
if conn.IsTLS {
if conn.Config.TLSConfig != nil {
client.SetMode(modes.TLS, true)
// error is not useful to us here anyways so we can ignore it
client.certfp, _ = socket.CertFP()
}
if conn.IsTor {
if conn.Config.IsTor {
client.SetMode(modes.TLS, true)
// cover up details of the tor proxying infrastructure (not a user privacy concern,
// but a hardening measure):