Documentation ¶
Overview ¶
Package handler is a wrapper around the ping package to listen and handle connections for displaying information to Minecraft clients.
Index ¶
- Variables
- func ClearHandlers(hostnames []string)
- func ClearStatus(hostnames []string)
- func Forward(hostnames []string, address string)
- func Handle(hostnames []string, handler Handler)
- func Listen(port string) error
- func SetStatus(hostnames []string, status *ping.Status)
- func Stop()
- type Handler
- type Player
Constants ¶
This section is empty.
Variables ¶
var OnForwardConnect func(ipAddress string)
OnForwardConnect is called whenever a connection is forwarded to the given IP address, excluding server list pings.
var OnForwardDisconnect func(ipAddress string, duration time.Duration)
OnForwardDisconnect is called when a forwarded connection is closed from the given IP address, excluding server list pings.
Functions ¶
func ClearHandlers ¶
func ClearHandlers(hostnames []string)
ClearHandlers clears any connection handlers from Handle and Forward binded to the given list of hostnames.
func ClearStatus ¶
func ClearStatus(hostnames []string)
ClearStatus clears the current status that was to be displayed on the server list for the given matching hostnames.
func Forward ¶
Forward forwards the connection to the specified address when a player attempts to connect to the server with the given list of hostnames. The address MUST include the port number (usually 25565). Overrides any handlers set by Handle, and also forwards any server list status requests, but does NOT override any statuses stored. If you call Handle again, the previously used Status will be used.
func Handle ¶
Handle sets the handler function that is called when a player attempts to connect to the server with the given list of hostnames. The function should return the message to be displayed to the player. Overrides any handlers set by Forward.
Types ¶
type Handler ¶
A Handler is used for handling when a player attempts to connect to the server. See Handle.
type Player ¶
type Player struct { IPAddress string Username string Hostname string ShouldClose bool ForwardAddress string InitialPacket *protocol.Packet State int Stream protocol.Stream Connection net.Conn }
Player is the container for the information of a player and their connection. See OnConnect.