github.com/df-mc/dragonfly@v0.9.13/server/allower.go (about) 1 package server 2 3 import ( 4 "github.com/sandertv/gophertunnel/minecraft/protocol/login" 5 "net" 6 ) 7 8 // Allower may be implemented to specifically allow or disallow players from 9 // joining a Server, by setting the specific Allower implementation through a 10 // call to Server.Allow. 11 type Allower interface { 12 // Allow filters what connections are allowed to connect to the Server. The 13 // address, identity data, and client data of the connection are passed. If 14 // Admit returns false, the connection is closed with the string returned as 15 // the disconnect message. WARNING: Use the client data at your own risk, it 16 // cannot be trusted because it can be freely changed by the player 17 // connecting. 18 Allow(addr net.Addr, d login.IdentityData, c login.ClientData) (string, bool) 19 } 20 21 // allower is the standard Allower implementation. It accepts all connections. 22 type allower struct{} 23 24 // Allow always returns true. 25 func (allower) Allow(net.Addr, login.IdentityData, login.ClientData) (string, bool) { 26 return "", true 27 }