forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
allower.go
27 lines (23 loc) · 1.01 KB
/
allower.go
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
package server
import (
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/protocol/login"
"net"
)
// Allower may be implemented to specifically allow or disallow players from
// joining a Server, by setting the specific Allower implementation through a
// call to Server.Allow.
type Allower interface {
// Allow filters what connections are allowed to connect to the Server. The
// address, identity data, and client data of the connection are passed. If
// Admit returns false, the connection is closed with the string returned as
// the disconnect message. WARNING: Use the client data at your own risk, it
// cannot be trusted because it can be freely changed by the player
// connecting.
Allow(addr net.Addr, d login.IdentityData, c login.ClientData) (string, bool)
}
// allower is the standard Allower implementation. It accepts all connections.
type allower struct{}
// Allow always returns true.
func (allower) Allow(net.Addr, login.IdentityData, login.ClientData) (string, bool) {
return "", true
}