Exemple #1
0
 /** Transport, host, and port only. Never look at cost or other properties. */
 @Override
 public boolean equals(Object object) {
   if (object == this) return true;
   if ((object == null) || !(object instanceof RouterAddress)) return false;
   RouterAddress addr = (RouterAddress) object;
   return getPort() == addr.getPort()
       && DataHelper.eq(getHost(), addr.getHost())
       && DataHelper.eq(_transportStyle, addr._transportStyle);
   // DataHelper.eq(_options, addr._options) &&
   // DataHelper.eq(_expiration, addr._expiration);
 }
Exemple #2
0
 public String getProof() {
   StringBuilder buf = new StringBuilder(512);
   RouterInfo us = _context.router().getRouterInfo();
   buf.append("Hash: ").append(us.getIdentity().calculateHash().toBase64()).append('\n');
   // buf.append("Ident: ").append(us.getIdentity().toBase64()).append('\n');
   for (RouterAddress addr : us.getAddresses()) {
     buf.append(addr.getTransportStyle()).append(": ").append(addr.getHost()).append('\n');
   }
   buf.append("Caps: ").append(us.getCapabilities()).append('\n');
   buf.append("Date: ").append(new Date()); // no trailing newline
   String msg = buf.toString();
   byte[] data = DataHelper.getUTF8(msg);
   Signature sig = _context.dsa().sign(data, _context.keyManager().getSigningPrivateKey());
   buf.setLength(0);
   buf.append("---BEGIN I2P SIGNED MESSAGE---\n");
   buf.append(msg);
   buf.append("\n---BEGIN I2P SIGNATURE---\n");
   buf.append(sig.toBase64());
   buf.append("\n---END I2P SIGNATURE---");
   return buf.toString();
 }