net.i2p.data.Hash.toBase32()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中net.i2p.data.Hash.toBase32()方法的一些代码示例,展示了Hash.toBase32()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hash.toBase32()方法的具体详情如下:
包路径:net.i2p.data.Hash
类名称:Hash
方法名:toBase32

Hash.toBase32介绍

[英]For convenience.
[中]为了方便。

代码示例

代码示例来源:origin: i2p/i2p.i2p

@Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    buf.append("[DatabaseLookupMessage: ");
    buf.append("\n\tSearch Type: ").append(_type);
    buf.append("\n\tSearch Key: ");
    if (_type == Type.LS)
      buf.append(_key.toBase32());
    else
      buf.append(_key);
    if (_replyKey != null)
      buf.append("\n\tReply GW: ");
    else
      buf.append("\n\tFrom: ");
    buf.append(_fromHash);
    buf.append("\n\tReply Tunnel: ").append(_replyTunnel);
    if (_replyKey != null)
      buf.append("\n\tReply Key: ").append(_replyKey);
    if (_replyTag != null)
      buf.append("\n\tReply Tag: ").append(_replyTag);
    if (_dontIncludePeers != null) {
      buf.append("\n\tDon't Include Peers: ");
      buf.append(_dontIncludePeers.size());
    }
    buf.append("]");
    return buf.toString();
  }
}

代码示例来源:origin: i2p/i2p.i2p

@Override
  public String toString() {
    StringBuilder buf = new StringBuilder();
    buf.append("[DatabaseStoreMessage: ");
    buf.append("\n\tExpiration: ").append(new Date(_expiration));
    buf.append("\n\tUnique ID: ").append(getUniqueId());
    if (_replyToken != 0) {
      buf.append("\n\tReply token: ").append(_replyToken);
      buf.append("\n\tReply tunnel: ").append(_replyTunnel);
      buf.append("\n\tReply gateway: ").append(_replyGateway);
    }
    buf.append("\n\tKey: ");
    if (_dbEntry.getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO)
      buf.append(getKey());
    else
      buf.append(getKey().toBase32());
    buf.append("\n\tEntry: ").append(_dbEntry);
    buf.append(']');
    return buf.toString();
  }
}

代码示例来源:origin: i2p/i2p.i2p

/**
 *  This will be called twice, once by the inbound and once by the outbound pool.
 *  Synched with buildTunnels() above.
 */
public synchronized void removeTunnels(Hash destination) {
  if (destination == null) return;
  if (_log.shouldLog(Log.DEBUG))
    _log.debug("Removing tunnels for the client " + destination.toBase32());
  if (_context.clientManager().isLocal(destination)) {
    // race with buildTunnels() on restart of a client
    if (_log.shouldLog(Log.WARN))
      _log.warn("Not removing pool still registered with client manager: " + destination.toBase32(), new Exception("i did it"));
    return;
  }
  TunnelPool inbound = _clientInboundPools.remove(destination);
  TunnelPool outbound = _clientOutboundPools.remove(destination);
  if (inbound != null)
    inbound.shutdown();
  if (outbound != null)
    outbound.shutdown();
}

代码示例来源:origin: i2p/i2p.i2p

/**
 * Pick a random inbound tunnel from the given destination's pool.
 * Warning - selectOutboundTunnel(Hash, Hash) is preferred.
 *
 * @param destination if null, returns inbound exploratory tunnel
 * @return null if none
 */
public TunnelInfo selectInboundTunnel(Hash destination) { 
  if (destination == null) return selectInboundTunnel();
  TunnelPool pool = _clientInboundPools.get(destination);
  if (pool != null) {
    return pool.selectTunnel();
  }
  if (_log.shouldLog(Log.ERROR))
    _log.error("Want the inbound tunnel for " + destination.toBase32() +
         " but there isn't a pool?");
  return null;
}

代码示例来源:origin: i2p/i2p.i2p

/**
 * Pick the inbound tunnel with the gateway closest to the given hash
 * from the given destination's pool.
 * By using this instead of the random selectTunnel(),
 * we force some locality in OBEP-IBGW connections to minimize
 * those connections network-wide.
 *
 * @param destination if null, returns inbound exploratory tunnel
 * @param closestTo non-null
 * @return null if none
 * @since 0.8.10
 */
public TunnelInfo selectInboundTunnel(Hash destination, Hash closestTo) { 
  if (destination == null) return selectInboundExploratoryTunnel(closestTo);
  TunnelPool pool = _clientInboundPools.get(destination);
  if (pool != null) {
    return pool.selectTunnel(closestTo);
  }
  if (_log.shouldLog(Log.ERROR))
    _log.error("Want the inbound tunnel for " + destination.toBase32() +
         " but there isn't a pool?");
  return null;
}

代码示例来源:origin: i2p/i2p.i2p

Hash hash = ConvertToHash.getHash(h);
if (hash != null)
  altNames.add(hash.toBase32());

代码示例来源:origin: i2p/i2p.i2p

TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
  _context = ctx;
  _log = ctx.logManager().getLog(TunnelPool.class);
  _manager = mgr;
  _settings = settings;
  _tunnels = new ArrayList<TunnelInfo>(settings.getTotalQuantity());
  _peerSelector = sel;
  _expireSkew = _context.random().nextInt(90*1000);
  _started = System.currentTimeMillis();
  _lastRateUpdate = _started;
  String name;
  if (_settings.isExploratory()) {
    name = "exploratory";
  } else {
    name = _settings.getDestinationNickname();
    // just strip HTML here rather than escape it everywhere in the console
    if (name != null)
      name = DataHelper.stripHTML(name);
    else
      name = _settings.getDestination().toBase32();
  }
  _rateName = "tunnel.Bps." + name +
        (_settings.isInbound() ? ".in" : ".out");
  refreshSettings();
  ctx.statManager().createRateStat("tunnel.matchLease", "How often does our OBEP match their IBGW?", "Tunnels", 
                   new long[] {60*60*1000});
}

代码示例来源:origin: i2p/i2p.i2p

_log.warn(getJobId() + ": leaseSet expired " + DataHelper.formatDuration(exp) + " ago, firing search: " + _leaseSet.getHash().toBase32());

相关文章