Class NodeInfo

    • Method Detail

      • generateNID

        public static NID generateNID​(Hash h,
                                      int p,
                                      RandomSource random)
        Generate a secure NID that matches the Hash and port. Rules: First 4 bytes must match Hash. Next 2 bytes must match Hash ^ port. Remaining bytes may be random.
        Throws:
        IllegalArgumentException
      • getNID

        public NID getNID()
      • getDestination

        public Destination getDestination()
        Returns:
        may be null if we don't have it
      • getHash

        public Hash getHash()
      • getPort

        public int getPort()
      • lastSeen

        public long lastSeen()
      • hashCode

        public int hashCode()
        Description copied from class: SimpleDataStructure
        We assume the data has enough randomness in it, so use the first 4 bytes for speed. If this is not the case, override in the extending class.
        Overrides:
        hashCode in class SimpleDataStructure
      • equals

        public boolean equals​(Object o)
        Description copied from class: SimpleDataStructure
        Warning - this returns true for two different classes with the same size and same data, e.g. SessionKey and SessionTag, but you wouldn't put them in the same Set, would you?
        Overrides:
        equals in class SimpleDataStructure
      • toPersistentString

        public String toPersistentString()
        To persistent storage string. Format: NID:Hash:Destination:port First 3 in base 64; Destination may be empty string