blob: e0e3d1a9082de74bb03f96a83b521758c23819d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package proxy
import "github.com/anon55555/mt"
// Kick sends mt.ToCltDisco with the specified custom reason
// and closes the ClientConn.
func (cc *ClientConn) Kick(reason string) {
go func() {
ack, _ := cc.SendCmd(&mt.ToCltDisco{
Reason: mt.Custom,
Custom: reason,
})
select {
case <-cc.Closed():
case <-ack:
cc.Close()
}
}()
}
// Ban disconnects the ClientConn and prevents the underlying
// network address from connecting again.
func (cc *ClientConn) Ban() error {
cc.Kick("Banned by proxy.")
return authIface.Ban(cc.RemoteAddr().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)
}
|