From 5a1053e4fb71736b108018e49807d8470ea28ded Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Mon, 4 Feb 2013 11:21:26 +0000 Subject: [PATCH] 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). --- .../java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java | 4 ++-- .../java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java index 1e76389cd9..58ea0ee944 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java @@ -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; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java index 0f60c34b81..840cd89662 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java @@ -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; -- GitLab