コード例 #1
0
 public IPv6Node(byte[] compactNodeInfo)
 {
     byte[] nodeId = new byte[NodeID.Size];
     Array.Copy(compactNodeInfo, 0, nodeId, 0, NodeID.Size);
     ID              = new NodeID(nodeId);
     Contact         = new IPv6PeerContact(compactNodeInfo, NodeID.Size);
     CompactNodeInfo = compactNodeInfo;
 }
コード例 #2
0
        public IPv6Node(NodeID nodeId, IPv6PeerContact contact)
        {
            ID      = nodeId;
            Contact = contact;

            CompactNodeInfo = new byte[CompactInfoSize];
            Array.Copy(ID.Bytes, 0, CompactNodeInfo, 0, NodeID.Size);
            Contact.Encode(((Span <byte>)CompactNodeInfo).Slice(NodeID.Size));
        }
コード例 #3
0
 public static void Encode(Span <byte> bytes, NodeID nodeId, IPAddress ipAddress, int port)
 {
     nodeId.CopyTo(bytes);
     IPv6PeerContact.Encode(bytes.Slice(NodeID.Size), ipAddress, port);
 }