diff options
Diffstat (limited to 'moderation.go')
-rw-r--r-- | moderation.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/moderation.go b/moderation.go index e0e3d1a..ae4d620 100644 --- a/moderation.go +++ b/moderation.go @@ -1,6 +1,10 @@ package proxy -import "github.com/anon55555/mt" +import ( + "net" + + "github.com/anon55555/mt" +) // Kick sends mt.ToCltDisco with the specified custom reason // and closes the ClientConn. @@ -23,7 +27,7 @@ func (cc *ClientConn) Kick(reason string) { // network address from connecting again. func (cc *ClientConn) Ban() error { cc.Kick("Banned by proxy.") - return authIface.Ban(cc.RemoteAddr().String(), cc.name) + return authIface.Ban(cc.RemoteAddr().(*net.UDPAddr).IP.String(), cc.name) } // Unban removes a player from the ban list. It accepts both @@ -31,3 +35,8 @@ func (cc *ClientConn) Ban() error { func Unban(id string) error { return authIface.Unban(id) } + +// Banned reports whether a network address is banned. +func Banned(addr *net.UDPAddr) bool { + return authIface.Banned(addr) +} |