Documentation ¶
Overview ¶
Package d2remoteclient facilitates communication between a remote client and server.
Index ¶
- type RemoteClientConnection
- func (r *RemoteClientConnection) Close() error
- func (r RemoteClientConnection) GetConnectionType() d2clientconnectiontype.ClientConnectionType
- func (r RemoteClientConnection) GetUniqueID() string
- func (r *RemoteClientConnection) Open(connectionString, saveFilePath string) error
- func (r *RemoteClientConnection) SendPacketToServer(packet d2netpacket.NetPacket) error
- func (r *RemoteClientConnection) SetClientListener(listener d2networking.ClientListener)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RemoteClientConnection ¶
RemoteClientConnection is the implementation of ClientConnection for a remote client.
func Create ¶
func Create(l d2util.LogLevel, asset *d2asset.AssetManager) (*RemoteClientConnection, error)
Create constructs a new RemoteClientConnection and returns a pointer to it.
func (*RemoteClientConnection) Close ¶
func (r *RemoteClientConnection) Close() error
Close informs the server that this client has disconnected and sets RemoteClientConnection.active to false.
func (RemoteClientConnection) GetConnectionType ¶
func (r RemoteClientConnection) GetConnectionType() d2clientconnectiontype.ClientConnectionType
GetConnectionType returns an enum representing the connection type. See: d2clientconnectiontype
func (RemoteClientConnection) GetUniqueID ¶
func (r RemoteClientConnection) GetUniqueID() string
GetUniqueID returns RemoteClientConnection.uniqueID.
func (*RemoteClientConnection) Open ¶
func (r *RemoteClientConnection) Open(connectionString, saveFilePath string) error
Open runs serverListener() in a goroutine to continuously read UDP packets. It also sends a PlayerConnectionRequestPacket packet to the server (see d2netpacket).
func (*RemoteClientConnection) SendPacketToServer ¶
func (r *RemoteClientConnection) SendPacketToServer(packet d2netpacket.NetPacket) error
SendPacketToServer compresses the JSON encoding of a NetPacket and sends it to the server.
func (*RemoteClientConnection) SetClientListener ¶
func (r *RemoteClientConnection) SetClientListener(listener d2networking.ClientListener)
SetClientListener sets RemoteClientConnection.clientListener to the given value.