public override byte[] BuildResponse() { List <byte> data = new List <byte>(); data.AddRange(base.BuildResponse()); data.Add((byte)PortType); data.Add(ClientIndex); data.Add(UseGamePort); data.AddRange(HtonsExtensions.IPStringToBytes(LocalIP)); data.AddRange(HtonsExtensions.UshortPortToBytes(LocalPort)); return(data.ToArray()); }
public override byte[] BuildResponse() { //change packet type to challenge List <byte> data = new List <byte>(); data.AddRange(base.BuildResponse()); //Challenge data.AddRange(Challenge); //IP data.AddRange(HtonsExtensions.IPStringToBytes(RemoteIP)); data.AddRange(Spliter); //port data.AddRange(HtonsExtensions.PortToIntBytes(RemotePort)); return(data.ToArray()); }
public override byte[] BuildResponse() { //change packet type to challenge List <byte> data = new List <byte>(); PacketType = QRPacketType.Challenge; data.AddRange(base.BuildResponse()); //Challenge data.AddRange(new byte[] { 0x54, 0x54, 0x54, 0x00, 0x00 }); //IP data.AddRange(HtonsExtensions.IPStringToBytes(RemoteIP)); data.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 }); //port data.AddRange(HtonsExtensions.PortToIntBytes(RemotePort)); return(data.ToArray()); }
protected virtual void CheckPrivateIP(List <byte> header, GameServer server) { string localIP = ""; // now we check if there are private ip if (server.ServerData.KeyValue.ContainsKey("localip0")) { localIP = server.ServerData.KeyValue["localip0"]; } else if (server.ServerData.KeyValue.ContainsKey("localip1")) { localIP = server.ServerData.KeyValue["localip1"]; } if (localIP == "") { return; } header[0] ^= (byte)GameServerFlags.PrivateIPFlag; byte[] address = HtonsExtensions.IPStringToBytes(localIP); header.AddRange(address); }
protected void CheckICMPSupport(List <byte> header, GameServer server) { header[0] ^= (byte)GameServerFlags.ICMPIPFlag; byte[] address = HtonsExtensions.IPStringToBytes(server.RemoteQueryReportIP); header.AddRange(address); }