aboutsummaryrefslogtreecommitdiff
path: root/moderation.go
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-11-16 23:17:27 +0100
committerHimbeer <himbeer@disroot.org>2024-11-17 16:32:50 +0100
commitd0d39d2f9f3abb68eec146376b3233c8bc7c1cfa (patch)
tree70be515811406cdc3ba1ab8b56d3c6eccb2f0d59 /moderation.go
parente7d92562fcf05e4f9b7f6ba29b7cda529aab49bc (diff)
Allow plugins to implement authentication backends
Design decisions: * Config option specifies which of the registered backends is used * Name conflicts (including with builtins) make the backend registration fail * Builtin backends are not moved to plugins to avoid breaking existing setups confusion in general * Builtin backends are exposed to plugins (and have been for some time); Important information and internal methods are hidden to prevent interference from malicious plugins See doc/auth_backends.md and the related interface and function documentation for details. Closes #127.
Diffstat (limited to 'moderation.go')
-rw-r--r--moderation.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/moderation.go b/moderation.go
index d10661d..00d97b1 100644
--- a/moderation.go
+++ b/moderation.go
@@ -27,16 +27,6 @@ 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().(*net.UDPAddr).IP.String(), cc.name)
-}
-
-// Unban removes a player from the ban list. It accepts both
-// network addresses and player names.
-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)
+ ip := cc.RemoteAddr().(*net.UDPAddr).IP.String()
+ return DefaultAuth().Ban(ip, cc.name)
}