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

add two getters

This commit is contained in:
Shivaram Lingamneni 2017-10-15 18:01:59 -04:00
parent e540fde816
commit 7ccb485b50
2 changed files with 14 additions and 6 deletions

View File

@ -67,9 +67,7 @@ func webircHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
clientAddress := utils.IPString(client.socket.conn.RemoteAddr()) clientAddress := utils.IPString(client.socket.conn.RemoteAddr())
clientHostname := client.hostname clientHostname := client.hostname
server.configurableStateMutex.RLock() for _, info := range server.WebIRCConfig() {
defer server.configurableStateMutex.RUnlock()
for _, info := range server.webirc {
for _, address := range info.Hosts { for _, address := range info.Hosts {
if clientHostname == address || clientAddress == address { if clientHostname == address || clientAddress == address {
// confirm password and/or fingerprint // confirm password and/or fingerprint
@ -101,9 +99,7 @@ func proxyHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
clientAddress := utils.IPString(client.socket.conn.RemoteAddr()) clientAddress := utils.IPString(client.socket.conn.RemoteAddr())
clientHostname := client.hostname clientHostname := client.hostname
server.configurableStateMutex.RLock() for _, address := range server.ProxyAllowedFrom() {
defer server.configurableStateMutex.RUnlock()
for _, address := range server.proxyAllowedFrom {
if clientHostname == address || clientAddress == address { if clientHostname == address || clientAddress == address {
proxiedIP := msg.Params[1] proxiedIP := msg.Params[1]

View File

@ -23,6 +23,18 @@ func (server *Server) getPassword() []byte {
return server.password return server.password
} }
func (server *Server) ProxyAllowedFrom() []string {
server.configurableStateMutex.RLock()
defer server.configurableStateMutex.RUnlock()
return server.proxyAllowedFrom
}
func (server *Server) WebIRCConfig() []webircConfig {
server.configurableStateMutex.RLock()
defer server.configurableStateMutex.RUnlock()
return server.webirc
}
func (client *Client) getNick() string { func (client *Client) getNick() string {
client.stateMutex.RLock() client.stateMutex.RLock()
defer client.stateMutex.RUnlock() defer client.stateMutex.RUnlock()