Allow any domain name to be mapped to an IP

This enables .onion domain names to be accessed by clients that are being
routed through the SOCKS tunnel by e.g. proxychains (assuming that the SOCKS
tunnel has been configured with a SOCKS outproxy that exits into Tor). If the
.onion is not mapped to an IP address, the client would attempt a DNS lookup
which would of course fail to find the .onion.

Clearnet domain names can also be mapped to IPs, but this is irrelevant as DNS
lookups work through SOCKS (via the configured outproxy).
This commit is contained in:
str4d
2013-02-04 11:21:26 +00:00
parent 0052ebf334
commit 5a1053e4fb
2 changed files with 4 additions and 4 deletions

View File

@@ -118,9 +118,9 @@ public class SOCKS4aServer extends SOCKSServer {
}
}
// Check if the requested IP should be mapped to a .i2p URL
// Check if the requested IP should be mapped to a URL
String mappedUrl = getMappedUrlForIP(connHostName);
if (mappedUrl != null && mappedUrl.toLowerCase(Locale.US).endsWith(".i2p")) {
if (mappedUrl != null) {
_log.debug("IPV4 address " + connHostName + " was mapped to URL " + mappedUrl);
connHostName = mappedUrl;
}

View File

@@ -206,9 +206,9 @@ public class SOCKS5Server extends SOCKSServer {
connHostName += ".";
}
}
// Check if the requested IP should be mapped to a .i2p URL
// Check if the requested IP should be mapped to a URL
String mappedUrl = getMappedUrlForIP(connHostName);
if (mappedUrl != null && mappedUrl.toLowerCase(Locale.US).endsWith(".i2p")) {
if (mappedUrl != null) {
_log.debug("IPV4 address " + connHostName + " was mapped to URL " + mappedUrl);
addressType = AddressType.DOMAINNAME;
connHostName = mappedUrl;