[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1319: Get Tor's socks address and port when it starts so our geoip (in trunk: doc src/gui/network src/util/geoip)
Author: edmanm
Date: 2006-10-08 22:42:49 -0400 (Sun, 08 Oct 2006)
New Revision: 1319
Modified:
trunk/doc/TODO
trunk/src/gui/network/netviewer.cpp
trunk/src/util/geoip/geoipresolver.cpp
trunk/src/util/geoip/geoipresolver.h
Log:
Get Tor's socks address and port when it starts so our geoip resolver knows
who to talk to.
Modified: trunk/doc/TODO
===================================================================
--- trunk/doc/TODO 2006-10-09 02:34:04 UTC (rev 1318)
+++ trunk/doc/TODO 2006-10-09 02:42:49 UTC (rev 1319)
@@ -18,8 +18,6 @@
simply sending an empty one.
* GeoIP requests should be encrypted so the exit node does not know what is
being requested and cannot muck with the requests or responses.
- * We should do a "getconf socksport" before setting a connection up through
- Tor, instead of just picking 9050 and hoping the user didn't change it.
Features planned for 0.1.x:
Modified: trunk/src/gui/network/netviewer.cpp
===================================================================
--- trunk/src/gui/network/netviewer.cpp 2006-10-09 02:34:04 UTC (rev 1318)
+++ trunk/src/gui/network/netviewer.cpp 2006-10-09 02:42:49 UTC (rev 1319)
@@ -137,6 +137,8 @@
void
NetViewer::gotConnected()
{
+ _geoip.setSocksHost(_torControl->getSocksAddress(),
+ _torControl->getSocksPort());
refresh();
_refreshTimer.start();
}
Modified: trunk/src/util/geoip/geoipresolver.cpp
===================================================================
--- trunk/src/util/geoip/geoipresolver.cpp 2006-10-09 02:34:04 UTC (rev 1318)
+++ trunk/src/util/geoip/geoipresolver.cpp 2006-10-09 02:42:49 UTC (rev 1319)
@@ -35,6 +35,15 @@
#define GEOIP_PAGE "/cgi-bin/geoip"
+/** Sets the address and port of Tor, through which GeoIP requests will be
+ * made. */
+void
+GeoIpResolver::setSocksHost(QHostAddress addr, quint16 port)
+{
+ _socksAddr = addr;
+ _socksPort = port;
+}
+
/** Resolves a list of IPs to a geographic location, but only those which are
* cached. Returns a list of IPs that were not in the cache. */
QList<QHostAddress>
@@ -159,7 +168,7 @@
TorSocket*
GeoIpResolver::createRequestSocket()
{
- TorSocket *socket = new TorSocket(QHostAddress::LocalHost, 9050);
+ TorSocket *socket = new TorSocket(_socksAddr, _socksPort);
connect(socket, SIGNAL(connectedToHost()), this, SLOT(connected()),
Qt::QueuedConnection);
connect(socket, SIGNAL(socketError(QString)),
Modified: trunk/src/util/geoip/geoipresolver.h
===================================================================
--- trunk/src/util/geoip/geoipresolver.h 2006-10-09 02:34:04 UTC (rev 1318)
+++ trunk/src/util/geoip/geoipresolver.h 2006-10-09 02:42:49 UTC (rev 1319)
@@ -47,8 +47,12 @@
public:
/** Default constructor. */
- GeoIpResolver() {}
-
+ GeoIpResolver()
+ { _socksAddr = QHostAddress::LocalHost; _socksPort = 9050; }
+
+ /** Sets the address and port of Tor, through which GeoIP requests will be
+ * made. */
+ void setSocksHost(QHostAddress addr, quint16 port);
/** Resolves a single IP to a geographic location. */
int resolve(QHostAddress ip);
/** Resolves a list of IPs to a geographic location. */
@@ -81,6 +85,10 @@
GeoIpCache _cache;
/**< List of sockets used for requests. */
QHash<TorSocket *,GeoIpRequest*> _requestList;
+ /** Tor's SocksListenAddress. */
+ QHostAddress _socksAddr;
+ /** Tor's SocksPort. */
+ quint16 _socksPort;
};
#endif