java.lang.Object
net.i2p.router.transport.udp.RemoteHostId
Unique ID for a peer - its IP + port, all bundled into a tidy obj. If the remote peer is not reachable through an IP+port, this contains the hash of their identity.
Field Summary
Constructor Summary
ModifierConstructorDescriptionRemoteHostId(byte[] ip, int port) Direct (IP + port).privateRemoteHostId(byte[] ip, int port, Hash peerHash) Combines an address, port and hash into one key.RemoteHostId(Hash peerHash) Indirect (hash only).Method Summary
All Methods
Field Details
_ip
private final byte[] _ipThe peer's address bytes._port
private final int _portThe peer's SSU port._peerHash
The peer's hash, if known._hashCode
private final int _hashCodePrecomputed hash of the id.
Constructor Details
RemoteHostId
public RemoteHostId(byte[] ip, int port) Direct (IP + port).- Parameters:
ip- the peer's address bytes, 4 or 16 longport- the UDP port the peer is reachable on
RemoteHostId
Indirect (hash only).- Parameters:
peerHash- the hash of the peer's RouterIdentity
RemoteHostId
Combines an address, port and hash into one key.- Parameters:
ip- the address bytesport- the SSU portpeerHash- the peer's hash, may be null
Method Details
getIP
public byte[] getIP()The IP address, or null if indirect.- Returns:
- the raw address bytes, or null for a hash-only id
getPort
public int getPort()The port, or 0 if indirect.- Returns:
- the peer's UDP port, or 0 for a hash-only id
getPeerHash
The peer hash, or null if direct.- Returns:
- the hash of the peer's RouterIdentity, or null for a direct id
hashCode
equals
toString