1
0
Fork 0
forked from External/ergo

Merge pull request #565 from slingamn/listener_refactor.3

refactor listener config loading
This commit is contained in:
Shivaram Lingamneni 2019-07-12 11:08:04 -04:00 committed by GitHub
commit ecf945038f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 212 additions and 160 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):