[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] r24433: {arm} Couple small fixes: fix: using Tor's internal address when n (arm/trunk/src/interface/connections)
Author: atagar
Date: 2011-03-25 02:30:48 +0000 (Fri, 25 Mar 2011)
New Revision: 24433
Modified:
arm/trunk/src/interface/connections/connEntry.py
Log:
Couple small fixes:
fix: using Tor's internal address when not expanding (patch by Fabian Keil)
fix: sorting scrubbed ip addresses at the end
Modified: arm/trunk/src/interface/connections/connEntry.py
===================================================================
--- arm/trunk/src/interface/connections/connEntry.py 2011-03-24 10:56:13 UTC (rev 24432)
+++ arm/trunk/src/interface/connections/connEntry.py 2011-03-25 02:30:48 UTC (rev 24433)
@@ -29,6 +29,9 @@
LABEL_FORMAT = "%s --> %s %s%s"
LABEL_MIN_PADDING = 2 # min space between listing label and following data
+# sort value for scrubbed ip addresses
+SCRUBBED_IP_VAL = 255 ** 4
+
CONFIG = {"features.connection.markInitialConnections": True,
"features.connection.showExitPort": True,
"features.connection.showColumn.fingerprint": True,
@@ -149,25 +152,28 @@
Provides the value of a single attribute used for sorting purposes.
"""
+ connLine = self.lines[0]
if attr == entries.SortAttr.IP_ADDRESS:
- return self.lines[0].sortIpAddr
+ if connLine.isPrivate(): return SCRUBBED_IP_VAL # orders at the end
+ return connLine.sortIpAddr
elif attr == entries.SortAttr.PORT:
- return self.lines[0].sortPort
+ return connLine.sortPort
elif attr == entries.SortAttr.HOSTNAME:
- return self.lines[0].foreign.getHostname("")
+ if connLine.isPrivate(): return ""
+ return connLine.foreign.getHostname("")
elif attr == entries.SortAttr.FINGERPRINT:
- return self.lines[0].foreign.getFingerprint()
+ return connLine.foreign.getFingerprint()
elif attr == entries.SortAttr.NICKNAME:
- myNickname = self.lines[0].foreign.getNickname()
+ myNickname = connLine.foreign.getNickname()
if myNickname == "UNKNOWN": return "z" * 20 # orders at the end
else: return myNickname.lower()
elif attr == entries.SortAttr.CATEGORY:
- return Category.indexOf(self.lines[0].getType())
+ return Category.indexOf(connLine.getType())
elif attr == entries.SortAttr.UPTIME:
- return self.lines[0].startTime
+ return connLine.startTime
elif attr == entries.SortAttr.COUNTRY:
if connections.isIpAddressPrivate(self.lines[0].foreign.getIpAddr()): return ""
- else: return self.lines[0].foreign.getLocale("")
+ else: return connLine.foreign.getLocale("")
else:
return entries.ConnectionPanelEntry.getSortValue(self, attr, listingType)
@@ -508,7 +514,8 @@
isExpansionType = not myType in (Category.PROGRAM, Category.CONTROL)
- srcAddress = myExternalIpAddr + localPort
+ if isExpansionType: srcAddress = myExternalIpAddr + localPort
+ else: srcAddress = self.local.getIpAddr() + localPort
src = "%-21s" % srcAddress # ip:port = max of 21 characters
dst = "%-26s" % dstAddress # ip:port (xx) = max of 26 characters
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits