owenson / tor-research-framework

Tor research framework in Java
www.ghowen.me
GNU General Public License v3.0
55 stars 16 forks source link

OnionRouter.toString() shows IPs with a slash prefix #9

Closed twilsonb closed 10 years ago

twilsonb commented 10 years ago

Every IP displayed using OnionRouter.toString() shows IPs with a slash prefix.

I've tried searching OnionRouter, Consensus, and InetAddress, and I still have no idea why this is happening. But it appears to be cosmetic only.

The issue occurs for all OnionRouter IPs, whether the consensus is cached or not. It does not occur in the consensus document itself.

Consensus Spec

"r" SP nickname SP identity SP digest SP publication SP IP SP ORPort 1578 SP DirPort NL

Ref: https://gitweb.torproject.org/torspec.git/blob/HEAD:/dir-spec.txt Section 3.4.1, Line 1577

Consensus Example

r marvellous AAcif1htILdru0BO0qX7OwGVhAU e43chEQrRVfmfiTQedCqcn3zbNQ 2014-07-30 09:41:20 176.212.13.30 9001 9030

Ref: cached-consensus downloaded by ConsensusExample

Listing all bad exits

OnionRouter [name=Unnamed, ip=/192.254.168.26, orport=9001, identityhash=0cc9b8aa649881c39e948e70b662772d8695c2e9]

Ref: output of ConsensusExample

twilsonb commented 10 years ago

This is a feature of Java, not a bug:

/**
 * Converts this IP address to a {@code String}. The
 * string returned is of the form: hostname / literal IP
 * address.
 *
 * If the host name is unresolved, no reverse name service lookup
 * is performed. The hostname part will be represented by an empty string.
 *
 * @return  a string representation of this IP address.
 */
public String toString() {
    String hostName = holder().getHostName();
    return ((hostName != null) ? hostName : "")
        + "/" + getHostAddress();
}
owenson commented 10 years ago

see 68d18a6968f7813f8cf97fcb68c0e5208eb205ae