Ejemplo n.º 1
0
    def __init__(self, env, controller):
        super().__init__()
        # Initialise the Peer class
        Peer.DEFAULT_PORTS = env.coin.PEER_DEFAULT_PORTS
        self.env = env
        self.controller = controller
        self.loop = controller.loop
        if env.irc and env.coin.IRC_PREFIX:
            self.irc = IRC(env, self)
        else:
            self.irc = None

        # Our clearnet and Tor Peers, if any
        self.myselves =  [Peer(ident.host, env.server_features(), 'env')
                          for ident in env.identities]
        self.retry_event = asyncio.Event()
        # Peers have one entry per hostname.  Once connected, the
        # ip_addr property is either None, an onion peer, or the
        # IP address that was connected to.  Adding a peer will evict
        # any other peers with the same host name or IP address.
        self.peers = set()
        self.permit_onion_peer_time = time.time()
        self.proxy = SocksProxy(env.tor_proxy_host, env.tor_proxy_port,
                                loop=self.loop)
        self.import_peers()
Ejemplo n.º 2
0
 def __init__(self, env, controller):
     super().__init__()
     # Initialise the Peer class
     Peer.DEFAULT_PORTS = env.coin.PEER_DEFAULT_PORTS
     self.env = env
     self.controller = controller
     self.loop = controller.loop
     self.myselves = peers_from_env(env)
     self.retry_event = asyncio.Event()
     # Peers have one entry per hostname.  Once connected, the
     # ip_addr property is either None, an onion peer, or the
     # IP address that was connected to.  Adding a peer will evict
     # any other peers with the same host name or IP address.
     self.peers = set()
     self.permit_onion_peer_time = time.time()
     self.proxy = SocksProxy(env.tor_proxy_host, env.tor_proxy_port,
                             loop=self.loop)
     self.import_peers()
Ejemplo n.º 3
0
 def __init__(self, env, controller):
     super().__init__()
     # Initialise the Peer class
     Peer.DEFAULT_PORTS = env.coin.PEER_DEFAULT_PORTS
     self.env = env
     self.controller = controller
     self.loop = controller.loop
     self.irc = IRC(env, self)
     self.myself = peer_from_env(env)
     # value is max outgoing connections at a time
     self.semaphore = asyncio.BoundedSemaphore(value=8)
     self.retry_event = asyncio.Event()
     # Peers have one entry per hostname.  Once connected, the
     # ip_addr property is either None, an onion peer, or the
     # IP address that was connected to.  Adding a peer will evict
     # any other peers with the same host name or IP address.
     self.peers = set()
     self.onion_peers = []
     self.last_tor_retry_time = 0
     self.tor_proxy = SocksProxy(env.tor_proxy_host, env.tor_proxy_port,
                                 loop=self.loop)
     self.import_peers()