protected virtual void CheckNonStandardPort(List <byte> header, GameServer server) { ///only dedicated server have different query report port and host port ///the query report port and host port are the same on peer server ///so we do not need to check this for peer server //we check host port is standard port or not if (!server.ServerData.KeyValue.ContainsKey("hostport")) { return; } if (server.ServerData.KeyValue["hostport"] == "") { return; } if (server.ServerData.KeyValue["hostport"] != "6500") { header[0] ^= (byte)GameServerFlags.NonStandardPort; //we do not need htons here byte[] port = HtonsExtensions.PortToIntBytes( server.ServerData.KeyValue["hostport"]); byte[] htonPort = HtonsExtensions.UshortPortToHtonBytes( server.ServerData.KeyValue["hostport"]); header.AddRange(htonPort); } }
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 CheckPrivatePort(List <byte> header, GameServer server) { // we check private port here if (!server.ServerData.KeyValue.ContainsKey("privateport")) { return; } if (server.ServerData.KeyValue["privateport"] == "") { return; } header[0] ^= (byte)GameServerFlags.NonStandardPrivatePortFlag; byte[] port = HtonsExtensions.PortToIntBytes( server.ServerData.KeyValue["privateport"]); header.AddRange(port); }