3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 21:39:25 +01:00

Merge pull request #1034 from slingamn/rename

correct old proxiedConn name
This commit is contained in:
Shivaram Lingamneni 2020-05-19 06:40:24 -07:00 committed by GitHub
commit b94e7ea985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,20 +265,20 @@ type ClientDetails struct {
// RunClient sets up a new client and runs its goroutine. // RunClient sets up a new client and runs its goroutine.
func (server *Server) RunClient(conn IRCConn) { func (server *Server) RunClient(conn IRCConn) {
proxiedConn := conn.UnderlyingConn() wConn := conn.UnderlyingConn()
var isBanned bool var isBanned bool
var banMsg string var banMsg string
realIP := utils.AddrToIP(proxiedConn.RemoteAddr()) realIP := utils.AddrToIP(wConn.RemoteAddr())
var proxiedIP net.IP var proxiedIP net.IP
if proxiedConn.Config.Tor { if wConn.Config.Tor {
// 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):
proxiedIP = utils.IPv4LoopbackAddress proxiedIP = utils.IPv4LoopbackAddress
isBanned, banMsg = server.checkTorLimits() isBanned, banMsg = server.checkTorLimits()
} else { } else {
ipToCheck := realIP ipToCheck := realIP
if proxiedConn.ProxiedIP != nil { if wConn.ProxiedIP != nil {
proxiedIP = proxiedConn.ProxiedIP proxiedIP = wConn.ProxiedIP
ipToCheck = proxiedIP ipToCheck = proxiedIP
} }
isBanned, banMsg = server.checkBans(ipToCheck) isBanned, banMsg = server.checkBans(ipToCheck)
@ -303,7 +303,7 @@ func (server *Server) RunClient(conn IRCConn) {
lastActive: now, lastActive: now,
channels: make(ChannelSet), channels: make(ChannelSet),
ctime: now, ctime: now,
isSTSOnly: proxiedConn.Config.STSOnly, isSTSOnly: wConn.Config.STSOnly,
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,
@ -329,7 +329,7 @@ func (server *Server) RunClient(conn IRCConn) {
lastActive: now, lastActive: now,
realIP: realIP, realIP: realIP,
proxiedIP: proxiedIP, proxiedIP: proxiedIP,
isTor: proxiedConn.Config.Tor, isTor: wConn.Config.Tor,
} }
client.sessions = []*Session{session} client.sessions = []*Session{session}
@ -337,13 +337,13 @@ func (server *Server) RunClient(conn IRCConn) {
session.resetFakelag() session.resetFakelag()
ApplyUserModeChanges(client, config.Accounts.defaultUserModes, false, nil) ApplyUserModeChanges(client, config.Accounts.defaultUserModes, false, nil)
if proxiedConn.Secure { if wConn.Secure {
client.SetMode(modes.TLS, true) client.SetMode(modes.TLS, true)
} }
if proxiedConn.Config.TLSConfig != nil { if wConn.Config.TLSConfig != nil {
// error is not useful to us here anyways so we can ignore it // error is not useful to us here anyways so we can ignore it
session.certfp, _ = utils.GetCertFP(proxiedConn.Conn, RegisterTimeout) session.certfp, _ = utils.GetCertFP(wConn.Conn, RegisterTimeout)
} }
if session.isTor { if session.isTor {
@ -351,7 +351,7 @@ func (server *Server) RunClient(conn IRCConn) {
client.rawHostname = session.rawHostname client.rawHostname = session.rawHostname
} else { } else {
if config.Server.CheckIdent { if config.Server.CheckIdent {
client.doIdentLookup(proxiedConn.Conn) client.doIdentLookup(wConn.Conn)
} }
} }