Exemplo n.º 1
0
func NewCodec(connectClient Connect) packet.PacketCodec {
	packetCodecs := make([]packet.PacketCodec, len(connect.PacketCodecs))
	copy(packetCodecs, connect.PacketCodecs)
	packetCodecs[connect.PACKET_RESULT] = connect.NewPacketResultCodec(connectClient)
	return packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(packetCodecs))
}
Exemplo n.º 2
0
func NewCodecRegistry(connectClient Connect) (codec *packet.PacketCodecRegistry) {
	registryCodec := connect.PacketCodec.Copy()
	registryCodec.DecodeCodecs[connect.PACKET_RESULT] = connect.NewPacketResultCodec(connectClient)
	codec = registryCodec
	return
}