[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] r24404: {arm} Adding a config option for omitting port information from ex (in arm/trunk: . src/interface/connections)



Author: atagar
Date: 2011-03-22 02:18:36 +0000 (Tue, 22 Mar 2011)
New Revision: 24404

Modified:
   arm/trunk/armrc.sample
   arm/trunk/src/interface/connections/connEntry.py
Log:
Adding a config option for omitting port information from exit connections.



Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample	2011-03-21 21:42:20 UTC (rev 24403)
+++ arm/trunk/armrc.sample	2011-03-22 02:18:36 UTC (rev 24404)
@@ -179,6 +179,7 @@
 features.connection.listingType 0
 features.connection.order 0, 2, 1
 features.connection.refreshRate 10
+features.connection.showExitPort true
 features.connection.showColumn.fingerprint true
 features.connection.showColumn.nickname true
 features.connection.showColumn.destination true

Modified: arm/trunk/src/interface/connections/connEntry.py
===================================================================
--- arm/trunk/src/interface/connections/connEntry.py	2011-03-21 21:42:20 UTC (rev 24403)
+++ arm/trunk/src/interface/connections/connEntry.py	2011-03-22 02:18:36 UTC (rev 24404)
@@ -29,7 +29,8 @@
 LABEL_FORMAT = "%s  -->  %s  %s%s"
 LABEL_MIN_PADDING = 2 # min space between listing label and following data
 
-CONFIG = {"features.connection.showColumn.fingerprint": True,
+CONFIG = {"features.connection.showExitPort": True,
+          "features.connection.showColumn.fingerprint": True,
           "features.connection.showColumn.nickname": True,
           "features.connection.showColumn.destination": True,
           "features.connection.showColumn.expandedIp": True}
@@ -691,9 +692,12 @@
       includeHostname - possibly includes the hostname
     """
     
+    # the port and port derived data can be hidden by config or without includePort
+    includePort = self.includePort and (CONFIG["features.connection.showExitPort"] or self.getType() != Category.EXIT)
+    
     # destination of the connection
     ipLabel = "<scrubbed>" if self.isPrivate() else self.foreign.getIpAddr()
-    portLabel = ":%s" % self.foreign.getPort() if self.includePort else ""
+    portLabel = ":%s" % self.foreign.getPort() if includePort else ""
     dstAddress = ipLabel + portLabel
     
     # Only append the extra info if there's at least a couple characters of
@@ -701,7 +705,7 @@
     if len(dstAddress) + 5 <= maxLength:
       spaceAvailable = maxLength - len(dstAddress) - 3
       
-      if self.getType() == Category.EXIT:
+      if self.getType() == Category.EXIT and includePort:
         purpose = connections.getPortUsage(self.foreign.getPort())
         
         if purpose:

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits