Documentation ¶
Overview ¶
Package d2udpclientconnection provides an implementation of a UDP client connection with a game state.
Index ¶
- type UDPClientConnection
- func (u UDPClientConnection) GetConnectionType() d2clientconnectiontype.ClientConnectionType
- func (u *UDPClientConnection) GetHeroState() *d2hero.HeroState
- func (u UDPClientConnection) GetUniqueID() string
- func (u *UDPClientConnection) SendPacketToClient(packet d2netpacket.NetPacket) error
- func (u *UDPClientConnection) SetHeroState(playerState *d2hero.HeroState)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UDPClientConnection ¶
UDPClientConnection is the implementation of the d2server.ClientConnection interface to represent remote client from the server perspective.
func CreateUDPClientConnection ¶
func CreateUDPClientConnection(udpConnection *net.UDPConn, id string, l d2util.LogLevel, address *net.UDPAddr) *UDPClientConnection
CreateUDPClientConnection constructs a new UDPClientConnection and returns a pointer to it.
func (UDPClientConnection) GetConnectionType ¶
func (u UDPClientConnection) GetConnectionType() d2clientconnectiontype.ClientConnectionType
GetConnectionType returns an enum representing the connection type. See: d2clientconnectiontype.
func (*UDPClientConnection) GetHeroState ¶
func (u *UDPClientConnection) GetHeroState() *d2hero.HeroState
GetHeroState returns UDPClientConnection.playerState.
func (UDPClientConnection) GetUniqueID ¶
func (u UDPClientConnection) GetUniqueID() string
GetUniqueID returns UDPClientConnection.id
func (*UDPClientConnection) SendPacketToClient ¶
func (u *UDPClientConnection) SendPacketToClient(packet d2netpacket.NetPacket) error
SendPacketToClient compresses the JSON encoding of a NetPacket and sends it to the client.
func (*UDPClientConnection) SetHeroState ¶
func (u *UDPClientConnection) SetHeroState(playerState *d2hero.HeroState)
SetHeroState sets UDP.playerState to the given value.