connect

package
v0.0.0-...-82a22e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2023 License: GPL-3.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	STATUS_ERROR_ROLE    = 0x02
	STATUS_ERROR_GENERIC = 0x01
	STATUS_SUCCESS       = 0x00

	REQUEST_AUTHENTICATE  = 0x00
	REQUEST_AS_SERVER     = 0x01
	REQUEST_AS_PROXY      = 0x02
	REQUEST_GET_SALT      = 0x03
	REQUEST_GET_WHOAMI    = 0x04
	REQUEST_MESSAGE       = 0x10
	REQUEST_REDIRECT      = 0x11
	REQUEST_GET_PLAYERS   = 0x20
	REQUEST_NOTIFY_PLAYER = 0x21
	REQUEST_GET_DETAILS   = 0x22

	PACKET_KEEPALIVE      = 0x00
	PACKET_REQUEST        = 0x01
	PACKET_RESULT         = 0x02
	PACKET_MESSAGE_EVENT  = 0x03
	PACKET_REDIRECT_EVENT = 0x04
	PACKET_SERVER_EVENT   = 0x05
)

Variables

View Source
var PacketCodec = packet.NewPacketCodecRegistry([]packet.PacketCodec{
	PACKET_KEEPALIVE:      new(packetKeepaliveCodec),
	PACKET_REQUEST:        new(packetRequestCodec),
	PACKET_RESULT:         new(packetResultCodec),
	PACKET_MESSAGE_EVENT:  new(packetMessageEventCodec),
	PACKET_REDIRECT_EVENT: new(packetRedirectEventCodec),
	PACKET_SERVER_EVENT:   new(packetServerEventCodec),
})

Functions

func NewPacketResultCodec

func NewPacketResultCodec(sequencer PacketResultSequencer) (this *packetResultCodec)

Types

type PacketKeepalive

type PacketKeepalive struct {
	Random int32
}

func NewPacketKeepalive

func NewPacketKeepalive(random int32) (this *PacketKeepalive)

func (*PacketKeepalive) Id

func (this *PacketKeepalive) Id() int

type PacketMessageEvent

type PacketMessageEvent struct {
	Sender  string
	Channel string
	Payload []byte
}

func NewPacketMessageEvent

func NewPacketMessageEvent(sender string, channel string, payload []byte) (this *PacketMessageEvent)

func (*PacketMessageEvent) Id

func (this *PacketMessageEvent) Id() int

type PacketRedirectEvent

type PacketRedirectEvent struct {
	Server string
	Player string
}

func NewPacketRedirectEvent

func NewPacketRedirectEvent(server string, player string) (this *PacketRedirectEvent)

func (*PacketRedirectEvent) Id

func (this *PacketRedirectEvent) Id() int

type PacketRequest

type PacketRequest struct {
	SequenceId int32
	Request    Request
}

func NewPacketRequest

func NewPacketRequest(sequenceId int32, request Request) (this *PacketRequest)

func (*PacketRequest) Id

func (this *PacketRequest) Id() int

type PacketResult

type PacketResult struct {
	SequenceId int32
	StatusCode uint8
	Result     Result
}

func NewPacketResult

func NewPacketResult(sequenceId int32, statusCode uint8, result Result) (this *PacketResult)

func (*PacketResult) Id

func (this *PacketResult) Id() int

type PacketResultSequencer

type PacketResultSequencer interface {
	RequestIdBySequenceId(int32) int
}

type PacketServerEvent

type PacketServerEvent struct {
	Add         bool
	Server      string
	SecurityKey string
	Address     string
	Port        uint16
}

func NewPacketServerEventAdd

func NewPacketServerEventAdd(server string, securityKey string, address string, port uint16) (this *PacketServerEvent)

func NewPacketServerEventRemove

func NewPacketServerEventRemove(server string) (this *PacketServerEvent)

func (*PacketServerEvent) Id

func (this *PacketServerEvent) Id() int

type Request

type Request interface {
	Id() int
}

type RequestAsProxy

type RequestAsProxy struct {
	Address    string
	Port       uint16
	Motd       string
	Version    string
	MaxPlayers uint16
}

func NewRequestAsProxy

func NewRequestAsProxy(address string, port uint16, motd string, version string, maxPlayers uint16) (this *RequestAsProxy)

func (*RequestAsProxy) Id

func (this *RequestAsProxy) Id() int

type RequestAsServer

type RequestAsServer struct {
	Address string
	Port    uint16
}

func NewRequestAsServer

func NewRequestAsServer(address string, port uint16) (this *RequestAsServer)

func (*RequestAsServer) Id

func (this *RequestAsServer) Id() int

type RequestAuthenticate

type RequestAuthenticate struct {
	Username string
	Password string
}

func NewRequestAuthenticate

func NewRequestAuthenticate(username string, password string) (this *RequestAuthenticate)

func (*RequestAuthenticate) Id

func (this *RequestAuthenticate) Id() int

type RequestCodec

type RequestCodec interface {
	Decode(reader io.Reader) (request Request, err error)
	Encode(writer io.Writer, request Request) (err error)
}

type RequestGetDetails

type RequestGetDetails struct {
}

func NewRequestGetDetails

func NewRequestGetDetails() (this *RequestGetDetails)

func (*RequestGetDetails) Id

func (this *RequestGetDetails) Id() int

type RequestGetPlayers

type RequestGetPlayers struct {
	List bool
}

func NewRequestGetPlayers

func NewRequestGetPlayers() (this *RequestGetPlayers)

func NewRequestGetPlayersList

func NewRequestGetPlayersList() (this *RequestGetPlayers)

func (*RequestGetPlayers) Id

func (this *RequestGetPlayers) Id() int

type RequestGetSalt

type RequestGetSalt struct {
}

func NewRequestGetSalt

func NewRequestGetSalt() (this *RequestGetSalt)

func (*RequestGetSalt) Id

func (this *RequestGetSalt) Id() int

type RequestGetWhoami

type RequestGetWhoami struct {
}

func NewRequestGetWhoami

func NewRequestGetWhoami() (this *RequestGetWhoami)

func (*RequestGetWhoami) Id

func (this *RequestGetWhoami) Id() int

type RequestMessage

type RequestMessage struct {
	Recipients []string
	Channel    string
	Message    []byte
}

func NewRequestMessage

func NewRequestMessage(recipients []string, channel string, message []byte) (this *RequestMessage)

func (*RequestMessage) Id

func (this *RequestMessage) Id() int

type RequestNotifyPlayer

type RequestNotifyPlayer struct {
	Add    bool
	Player string
	Uuid   uuid.UUID
}

func NewRequestNotifyPlayerAdd

func NewRequestNotifyPlayerAdd(player string, uuid uuid.UUID) (this *RequestNotifyPlayer)

func NewRequestNotifyPlayerRemove

func NewRequestNotifyPlayerRemove(player string, uuid uuid.UUID) (this *RequestNotifyPlayer)

func (*RequestNotifyPlayer) Id

func (this *RequestNotifyPlayer) Id() int

type RequestRedirect

type RequestRedirect struct {
	Server string
	Player string
}

func NewRequestRedirect

func NewRequestRedirect(server string, player string) (this *RequestRedirect)

func (*RequestRedirect) Id

func (this *RequestRedirect) Id() int

type Result

type Result interface {
	Id() int
}

type ResultAsProxy

type ResultAsProxy struct {
}

func NewResultAsProxy

func NewResultAsProxy() (this *ResultAsProxy)

func (*ResultAsProxy) Id

func (this *ResultAsProxy) Id() int

type ResultAsServer

type ResultAsServer struct {
	SecurityKey string
}

func NewResultAsServer

func NewResultAsServer(securityKey string) (this *ResultAsServer)

func (*ResultAsServer) Id

func (this *ResultAsServer) Id() int

type ResultAuthenticate

type ResultAuthenticate struct {
}

func NewResultAuthenticate

func NewResultAuthenticate() (this *ResultAuthenticate)

func (*ResultAuthenticate) Id

func (this *ResultAuthenticate) Id() int

type ResultCodec

type ResultCodec interface {
	Decode(reader io.Reader) (result Result, err error)
	Encode(writer io.Writer, result Result) (err error)
}

type ResultGetDetails

type ResultGetDetails struct {
	Ip      string
	Port    uint16
	Motd    string
	Version string
}

func NewResultGetDetails

func NewResultGetDetails(ip string, port uint16, motd string, version string) (this *ResultGetDetails)

func (*ResultGetDetails) Id

func (this *ResultGetDetails) Id() int

type ResultGetPlayers

type ResultGetPlayers struct {
	List           bool
	CurrentPlayers uint16
	MaxPlayers     uint16
	Players        []string
}

func NewResultGetPlayers

func NewResultGetPlayers(currentPlayers uint16, maxPlayers uint16) (this *ResultGetPlayers)

func NewResultGetPlayersList

func NewResultGetPlayersList(currentPlayers uint16, maxPlayers uint16, players []string) (this *ResultGetPlayers)

func (*ResultGetPlayers) Id

func (this *ResultGetPlayers) Id() int

type ResultGetSalt

type ResultGetSalt struct {
	Salt string
}

func NewResultGetSalt

func NewResultGetSalt(salt string) (this *ResultGetSalt)

func (*ResultGetSalt) Id

func (this *ResultGetSalt) Id() int

type ResultGetWhoami

type ResultGetWhoami struct {
	Whoiam string
}

func NewResultGetWhoami

func NewResultGetWhoami(whoiam string) (this *ResultGetWhoami)

func (*ResultGetWhoami) Id

func (this *ResultGetWhoami) Id() int

type ResultMessage

type ResultMessage struct {
}

func NewResultMessage

func NewResultMessage() (this *ResultMessage)

func (*ResultMessage) Id

func (this *ResultMessage) Id() int

type ResultNotifyPlayer

type ResultNotifyPlayer struct {
}

func NewResultNotifyPlayer

func NewResultNotifyPlayer() (this *ResultNotifyPlayer)

func (*ResultNotifyPlayer) Id

func (this *ResultNotifyPlayer) Id() int

type ResultRedirect

type ResultRedirect struct {
}

func NewResultRedirect

func NewResultRedirect() (this *ResultRedirect)

func (*ResultRedirect) Id

func (this *ResultRedirect) Id() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL