3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 13:29:27 +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())
clientHostname := client.hostname
server.configurableStateMutex.RLock()
defer server.configurableStateMutex.RUnlock()
for _, info := range server.webirc {
for _, info := range server.WebIRCConfig() {
for _, address := range info.Hosts {
if clientHostname == address || clientAddress == address {
// 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())
clientHostname := client.hostname
server.configurableStateMutex.RLock()
defer server.configurableStateMutex.RUnlock()
for _, address := range server.proxyAllowedFrom {
for _, address := range server.ProxyAllowedFrom() {
if clientHostname == address || clientAddress == address {
proxiedIP := msg.Params[1]

View File

@ -23,6 +23,18 @@ func (server *Server) getPassword() []byte {
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 {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()