diff options
Diffstat (limited to 'internal/config.go')
| -rw-r--r-- | internal/config.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/internal/config.go b/internal/config.go index 93549e2..17ec25b 100644 --- a/internal/config.go +++ b/internal/config.go @@ -38,11 +38,19 @@ func newConfig(configFile string) (config, error) { } func (c config) isParticipant(remoteAddr string) bool { - return c.isParticipantWithLookup(remoteAddr, net.LookupIP) + remoteAddr = stripPort(remoteAddr) + + for _, participant := range c.Participants { + if remoteAddr == stripPort(participant) { + return true + } + } + + return false } func (c config) isParticipantWithLookup(remoteAddr string, lookupIP func(string) ([]net.IP, error)) bool { - remoteIP := stripPort(remoteAddr) + remoteAddr = stripPort(remoteAddr) for _, participant := range c.Participants { ips, err := lookupIP(stripPort(participant)) @@ -52,7 +60,7 @@ func (c config) isParticipantWithLookup(remoteAddr string, lookupIP func(string) } for _, ip := range ips { - if remoteIP == ip.String() { + if remoteAddr == ip.String() { return true } } |
