def start(self): # Determine socks5 ports socks5_port = self.options['socks5'] if socks5_port is not None: socks_listen_ports = range(socks5_port, socks5_port + 5) else: socks_listen_ports = [random.randint(1000, 65535) for _ in range(5)] config = TriblerConfig() config.set_state_dir(os.path.join(config.get_state_dir(), "tunnel-%d") % socks_listen_ports[0]) config.set_tunnel_community_socks5_listen_ports(socks_listen_ports) config.set_torrent_checking_enabled(False) config.set_megacache_enabled(False) config.set_dispersy_enabled(False) config.set_ipv8_enabled(True) config.set_mainline_dht_enabled(True) config.set_torrent_collecting_enabled(False) config.set_libtorrent_enabled(False) config.set_video_server_enabled(False) config.set_dispersy_port(self.ipv8_port) config.set_torrent_search_enabled(False) config.set_channel_search_enabled(False) config.set_trustchain_enabled(True) config.set_credit_mining_enabled(False) config.set_market_community_enabled(False) config.set_mainline_dht_enabled(False) config.set_tunnel_community_exitnode_enabled(bool(self.options["exit"])) if "testnet" in self.options and self.options["testnet"]: config.set_ipv8_use_testnet(True) self.session = Session(config) logger.info("Using IPv8 port %d" % self.session.config.get_dispersy_port()) return self.session.start()
def start(self): # Determine socks5 ports socks5_port = self.options['socks5'] if "HELPER_INDEX" in os.environ and "HELPER_BASE" in os.environ: base_port = int(os.environ["HELPER_BASE"]) socks5_port = base_port + int(os.environ["HELPER_INDEX"]) * 5 if socks5_port is not None: socks_listen_ports = range(socks5_port, socks5_port + 5) else: socks_listen_ports = [ random.randint(1000, 65535) for _ in range(5) ] config = TriblerConfig() config.set_state_dir( os.path.join(config.get_state_dir(), "tunnel-%d") % socks_listen_ports[0]) config.set_tunnel_community_socks5_listen_ports(socks_listen_ports) config.set_torrent_checking_enabled(False) config.set_megacache_enabled(False) config.set_dispersy_enabled(False) config.set_ipv8_enabled(True) config.set_mainline_dht_enabled(True) config.set_torrent_collecting_enabled(False) config.set_libtorrent_enabled(False) config.set_video_server_enabled(False) config.set_dispersy_port(self.ipv8_port) config.set_ipv8_address(self.ipv8_address) config.set_torrent_search_enabled(False) config.set_channel_search_enabled(False) config.set_trustchain_enabled(True) config.set_credit_mining_enabled(False) config.set_market_community_enabled(False) config.set_mainline_dht_enabled(False) config.set_dht_enabled(True) config.set_tunnel_community_exitnode_enabled(bool( self.options["exit"])) config.set_popularity_community_enabled(False) config.set_testnet(bool(self.options["testnet"])) if self.options["restapi"] is not None: config.set_http_api_enabled(True) config.set_http_api_port(self.options["restapi"]) if self.options["ipv8_bootstrap_override"] is not None: config.set_ipv8_bootstrap_override( self.options["ipv8_bootstrap_override"]) self.session = Session(config) logger.info("Using IPv8 port %d" % self.session.config.get_dispersy_port()) self.session.notifier.add_observer(self.circuit_removed, NTFY_TUNNEL, [NTFY_REMOVE]) return self.session.start().addCallback(self.tribler_started)
def start(self): # Determine ipv8 port ipv8_port = -1 if self.options["ipv8_port"] != -1: ipv8_port = self.options["ipv8_port"] elif "HELPER_INDEX" in os.environ and "HELPER_BASE" in os.environ: base_port = int(os.environ["HELPER_BASE"]) ipv8_port = base_port + int(os.environ["HELPER_INDEX"]) * 5 config = TriblerConfig() config.set_state_dir(os.path.join(config.get_state_dir(), "tunnel-%d") % ipv8_port) config.set_tunnel_community_socks5_listen_ports([]) config.set_torrent_checking_enabled(False) config.set_megacache_enabled(False) config.set_dispersy_enabled(False) config.set_ipv8_enabled(True) config.set_torrent_collecting_enabled(False) config.set_libtorrent_enabled(False) config.set_video_server_enabled(False) config.set_dispersy_port(ipv8_port) config.set_ipv8_address(self.options["ipv8_address"]) config.set_torrent_search_enabled(False) config.set_channel_search_enabled(False) config.set_trustchain_enabled(True) config.set_credit_mining_enabled(False) config.set_market_community_enabled(False) config.set_mainline_dht_enabled(False) config.set_dht_enabled(True) config.set_tunnel_community_exitnode_enabled(bool(self.options["exit"])) config.set_popularity_community_enabled(False) config.set_testnet(bool(self.options["testnet"])) if not self.options['no-rest-api']: config.set_http_api_enabled(True) api_port = self.options["restapi"] if "HELPER_INDEX" in os.environ and "HELPER_BASE" in os.environ: api_port = int(os.environ["HELPER_BASE"]) + 10000 + int(os.environ["HELPER_INDEX"]) config.set_http_api_port(api_port) if self.options["ipv8_bootstrap_override"] is not None: config.set_ipv8_bootstrap_override(self.options["ipv8_bootstrap_override"]) self.session = Session(config) logger.info("Using IPv8 port %d" % self.session.config.get_dispersy_port()) self.session.notifier.add_observer(self.circuit_removed, NTFY_TUNNEL, [NTFY_REMOVE]) return self.session.start().addCallback(self.tribler_started)
def start_tribler(self): config = TriblerConfig() config.set_state_dir(os.path.join(config.get_state_dir(), "tunnel-%d") % self.settings.socks_listen_ports[0]) config.set_torrent_checking_enabled(False) config.set_megacache_enabled(False) config.set_dispersy_enabled(True) config.set_mainline_dht_enabled(True) config.set_torrent_collecting_enabled(False) config.set_libtorrent_enabled(True) config.set_video_server_enabled(False) config.set_dispersy_port(self.dispersy_port) config.set_torrent_search_enabled(False) config.set_channel_search_enabled(False) config.set_trustchain_enabled(self.settings.enable_trustchain) # We do not want to load the TunnelCommunity in the session but instead our own community config.set_tunnel_community_enabled(False) self.session = Session(config) self.session.start() logger.info("Using Dispersy port %d" % self.session.config.get_dispersy_port())