This commit is contained in:
shoopea 2020-06-15 12:42:02 +02:00
parent 6a615105b1
commit bc9beea374

23
main.go
View File

@ -61,9 +61,30 @@ func main() {
} }
switch p.PType {
case AdminPacketServerProtocol:
sp := PacketAdminServerProtocol{
Packet: p,
}
sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerProtocol :\n- ProtocolVersion: %v\n- FurtherData: %v\n- UpdatePacketType: %v\n- FrequenciesAllowed: %b", sp.ProtocolVersion, sp.FurtherData, sp.UpdatePacketType, sp.FrequenciesAllowed)
case AdminPacketServerWelcome:
sp := PacketAdminServerWelcome{
Packet: p,
}
sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerWelcome :\n- ServerName: %v\n- OpenTTDVersion: %v\n- Dedicated: %v\n- MapSeed: %x\n- MapLandscape: %v\n- MapStartDate: %v\n- Size: %v x %v", sp.ServerName, sp.OpenTTDVersion, sp.Dedicated, sp.MapSeed, sp.MapLandscape, sp.MapStartDate, sp.MapX, sp.MapY)
px := PacketAdminUpdateFrequency{
Packet: Packet{PType: AdminPacketAdminUpdateFrequency},
UpdateType: AdminUpdateDate,
UpdateFrequency: AdminFrequencyDaily,
}
_, err = conn.Write(p.Bytes())
default:
logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType) logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType)
}
handlePacket(p, b[:p.PLength]) readPacket(p, b[:p.PLength])
c := make([]byte, 0xFFFF) c := make([]byte, 0xFFFF)
copy(c, b[p.PLength:]) copy(c, b[p.PLength:])