Changeset 351
- Timestamp:
- 07/14/08 14:33:10 (6 months ago)
- Files:
-
- 1 modified
-
branches/0.5/daemon/orbited/binaryproxy.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.5/daemon/orbited/binaryproxy.py
r335 r351 1 from config import map as config 1 2 from tcp import TCPConnection, TCPConnectionFactory 2 3 from twisted.internet import reactor, defer … … 60 61 for item in self.buffer: 61 62 self.remote_conn.send(item) 63 # TODO clear buffer? 62 64 63 65 def dataReceived(self, data): … … 71 73 self.host = host 72 74 self.port = int(port) 75 # TODO DRY this with ProxyConnection. 76 if (self.host, self.port) not in config['[access]']: 77 log.warn('unauthorized', data) 78 raise (Exception("Unauthorized"), "(host, port) pair not authorized for proxying") 73 79 log.access(self.getClientIP(), "TCP/bin", " -> ", self.host, ":", self.port, " [ ", self.getClientIP(), " ]") 80 # TODO set errback (also look for errback misses in other classes)! 74 81 self.factory.client.connect(self.host, self.port).addCallback(self.connected_remote) 75 82 self.state = 'proxy' 76 83 except Exception, x: 84 # TODO when we raise the unauthorized message, the client does not understand it. 77 85 self.send("Invalid handhsake: " + str(x) + "(payload: %s)" % data) 78 86 self.loseConnection() … … 91 99 if self.remote_conn: 92 100 self.remote_conn.transport.loseConnection() 101 # TODO set connected=False et al? 93 102 # print "Proxy Connection Lost", self.id 94 103