Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API represents a service that enables servers to communicate with the proxy over the TCP protocol. It supports operations such as transferring and kicking players, and allows for the registration of custom packets via packet.Register(). Packets can be handled using RegisterHandler().
func (*API) Listen ¶
Listen sets up a net.Listener for incoming connections based on the specified address.
func (*API) RegisterHandler ¶ added in v0.0.20
RegisterHandler registers a handler for the specified packet.
type Authentication ¶ added in v0.0.4
type Authentication interface { // Authenticate checks if the provided token is valid. Authenticate(token string) bool }
Authentication defines an interface for authentication methods.
type Client ¶ added in v0.0.11
type Client struct {
// contains filtered or unexported fields
}
Client represents a connection to the API service, managing packet reading and writing over an underlying net.Conn.
func Dial ¶ added in v0.0.25
Dial establishes a TCP connection to the specified API service address using the provided token. It returns a new Client instance if the connection and authentication are successful. Otherwise, it returns an error indicating the failure reason.
func NewClient ¶ added in v0.0.11
NewClient creates a new Client instance using the provided net.Conn. It is used for reading and writing packets to the underlying connection.
func (*Client) ReadPacket ¶ added in v0.0.11
ReadPacket reads the next available packet from the connection and decodes it.
type SecretBasedAuthentication ¶ added in v0.0.5
type SecretBasedAuthentication struct {
// contains filtered or unexported fields
}
SecretBasedAuthentication implements the Authentication interface using a secret token for authentication.
func NewSecretBasedAuthentication ¶ added in v0.0.5
func NewSecretBasedAuthentication(secret string) *SecretBasedAuthentication
NewSecretBasedAuthentication creates a new SecretBasedAuthentication instance with the given secret token.
func (*SecretBasedAuthentication) Authenticate ¶ added in v0.0.5
func (authentication *SecretBasedAuthentication) Authenticate(token string) bool
Authenticate ...