示例#1
0
        public static byte[] ReadyCheckFirewall(FirewallTest fw)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt32(fw.Cookie);
            packet.WriteIP(((IPEndPoint)fw.EndPoint).Address);
            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_READYTOCHECKFIREWALL));
        }
示例#2
0
        public static byte[] AckNodes(IPEndPoint[] nodes)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);

            foreach (IPEndPoint ep in nodes)
            {
                packet.WriteIP(ep.Address);
                packet.WriteUInt16((ushort)ep.Port);
            }

            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_ACKNODES));
        }
示例#3
0
        public static byte[] AckIps(IPAddress target_ip, ulong time)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);

            UdpNode[] servers = UdpNodeManager.GetServers(target_ip, 6, time);

            foreach (UdpNode s in servers)
            {
                packet.WriteIP(s.IP);
                packet.WriteUInt16(s.Port);
            }

            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_ACKIPS));
        }
示例#4
0
        public static byte[] CheckFirewallBusy(IPAddress target_ip, ulong time)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);

            UdpNode[] servers = UdpNodeManager.GetServers(target_ip, 6, time);

            foreach (UdpNode s in servers)
            {
                packet.WriteIP(s.IP);
                packet.WriteUInt16(s.Port);
            }

            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_CHECKFIREWALLBUSY));
        }
示例#5
0
        public static byte[] AckInfo(ulong time)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);
            packet.WriteUInt16(UserPool.UserCount);
            packet.WriteString(Settings.Name);
            packet.WriteString(Settings.Topic);
            packet.WriteByte(Settings.Language);
            packet.WriteString(Settings.VERSION);
            UdpNode[] servers = UdpNodeManager.GetServers(6, time);
            packet.WriteByte((byte)servers.Length);

            foreach (UdpNode s in servers)
            {
                packet.WriteIP(s.IP);
                packet.WriteUInt16(s.Port);
            }

            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_ACKINFO));
        }