Пример #1
0
        public static byte[] WantCheckFirewall()
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);
            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_WANTCHECKFIREWALL));
        }
Пример #2
0
        public static byte[] ProceedCheckFirewall(uint cookie)
        {
            UdpPacketWriter packet = new UdpPacketWriter();

            packet.WriteUInt16(Settings.Port);
            packet.WriteUInt32(cookie);
            return(packet.ToAresPacket(UdpMsg.OP_SERVERLIST_PROCEEDCHECKFIREWALL));
        }
Пример #3
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));
        }
Пример #4
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));
        }
Пример #5
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));
        }
Пример #6
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));
        }
Пример #7
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));
        }