Exemplo n.º 1
0
func (this *SessionOutBridge) Serve() {
	this.codec = packet.NewPacketCodecVariable(minecraft.HandshakePacketServerCodec, minecraft.HandshakePacketClientCodec)
	this.connCodec = packet.NewPacketConnCodec(this.conn, this.codec, 10*time.Second)
	remotePort, _ := strconv.ParseUint(this.remotePort, 10, 8)
	this.Write(&minecraft.PacketServerHandshake{minecraft.VERSION, this.server.SecurityKey + ";" + this.session.remoteHost + ";" + this.session.remotePort + ";" + this.session.uuid, uint16(remotePort), 2})
	this.codec.SetEncodeCodec(minecraft.LoginPacketServerCodec)
	this.codec.SetDecodeCodec(minecraft.LoginPacketClientCodec)
	this.Write(&minecraft.PacketServerLoginStart{this.session.name})
	this.state = STATE_LOGIN
	go this.connCodec.ReadConn(this)
}
Exemplo n.º 2
0
func (this *Session) Serve() {
	this.codec = packet.NewPacketCodecVariable(minecraft.HandshakePacketClientCodec, minecraft.HandshakePacketServerCodec)
	this.connCodec = packet.NewPacketConnCodec(this.conn, this.codec, 10*time.Second)
	go this.connCodec.ReadConn(this)
}