コード例 #1
0
        public ConnectionRoute Copy()
        {
            ConnectionRoute route = new ConnectionRoute
            {
                ServerAddress = this.ServerAddress,
                ProxyRoute    = new List <TCPAddress>()
            };

            foreach (TCPAddress tcp_addr in this.ProxyRoute)
            {
                route.ProxyRoute.Add(tcp_addr.Copy());
            }
            return(route);
        }
コード例 #2
0
        public static ConnectionRoute FromBytes(byte[] bytes, int index = 0)
        {
            int pt = index;

            if (bytes[pt] == 1)
            {
                ConnectionRoute c = new ConnectionRoute();
                c.ServerAddress = TCPAddress.FromBytes(bytes, pt + 2);
                pt += 8;
                for (int i = 0; i < bytes[1]; ++i)
                {
                    c.ProxyRoute.Add(TCPAddress.FromBytes(bytes, pt));
                    pt += 6;
                }
                return(c);
            }
            return(null);
        }