Exemplo n.º 1
0
 def __init__(self, host, path="/"):
     AdvancedDispatcher.__init__(self)
     self.path = path
     self.destination = (host, 80)
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.connect(self.destination)
     print "connecting in background to %s:%i" % (self.destination[0], self.destination[1])
Exemplo n.º 2
0
 def __init__(self, host, path="/"):
     AdvancedDispatcher.__init__(self)
     self.path = path
     self.destination = (host, 80)
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.connect(self.destination)
     print "connecting in background to %s:%i" % (self.destination[0],
                                                  self.destination[1])
Exemplo n.º 3
0
 def __init__(self, address):
     if not isinstance(address, state.Peer):
         raise ValueError
     AdvancedDispatcher.__init__(self)
     self.destination = address
     self.isOutbound = True
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.connect(self.proxy)
Exemplo n.º 4
0
 def handle_connect(self):
     self.set_state("init")
     try:
         AdvancedDispatcher.handle_connect(self)
     except socket.error as e:
         if e.errno in asyncore._DISCONNECTED:
             logger.debug("%s:%i: Connection failed: %s", self.destination.host, self.destination.port, str(e))
             return
     self.state_init()
Exemplo n.º 5
0
 def __init__(self, address):
     if not isinstance(address, state.Peer):
         raise ValueError
     AdvancedDispatcher.__init__(self)
     self.destination = address
     self.isOutbound = True
     self.fullyEstablished = False
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.connect(self.proxy)
Exemplo n.º 6
0
 def __init__(self, address=None):
     if (not type(address) in (list, tuple)) or (len(address) < 2) or (type(
             address[0]) != type('')) or (type(address[1]) != int):
         raise
     AdvancedDispatcher.__init__(self, self.sock)
     self.destination = address
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.sslSocket.setblocking(0)
     self.connect(self.proxy)
Exemplo n.º 7
0
 def __init__(self, address):
     if not isinstance(address, state.Peer):
         raise ValueError
     AdvancedDispatcher.__init__(self)
     self.destination = address
     self.isOutbound = True
     self.fullyEstablished = False
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     if address.host.endswith(".onion") and self.onion_proxy is not None:
         self.connect(self.onion_proxy)
     else:
         self.connect(self.proxy)
Exemplo n.º 8
0
 def __init__(self, address):
     if not isinstance(address, Peer):
         raise ValueError
     AdvancedDispatcher.__init__(self)
     self.destination = address
     self.isOutbound = True
     self.fullyEstablished = False
     self.connectedAt = 0
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     if BMConfigParser().safeGetBoolean("bitmessagesettings",
                                        "socksauthentication"):
         self.auth = (BMConfigParser().safeGet("bitmessagesettings",
                                               "socksusername"),
                      BMConfigParser().safeGet("bitmessagesettings",
                                               "sockspassword"))
     else:
         self.auth = None
     self.connect(self.onion_proxy if address.host.endswith(".onion")
                  and self.onion_proxy else self.proxy)