Skip to content

Commit

Permalink
Remove BandwidthCommunity
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Jan 5, 2024
1 parent 76d9c15 commit 959169e
Show file tree
Hide file tree
Showing 49 changed files with 92 additions and 2,206 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scripttest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
with:
path: ./src

- name: run_bandwidth_crawler.py
- name: run_crawler.py
uses: ./.github/actions/timeout
with:
command: python ./scripts/bandwidth_crawler/run_bandwidth_crawler.py --fragile
command: python ./scripts/crawler/run_crawler.py --fragile
duration: ${{inputs.duration}}

- name: run_exit_node.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ ec_keypair_filename = string(default='ec_multichain.pem')
testnet_keypair_filename = string(default='ec_trustchain_testnet.pem')
testnet = boolean(default=False)

[bandwidth_accounting]
testnet = boolean(default=False)

[bootstrap]
enabled = boolean(default=True)
max_download_rate = integer(min=1, default=1000000)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bandwidth Crawler
# Crawler

## Requirements

Expand All @@ -8,5 +8,5 @@
## Execution

```shell
python3 run_bandwidth_crawler.py
python3 run_crawler.py
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""
This executable script starts a Tribler instance and joins the BandwidthAccountingCommunity.
This is an example of a Tribler crawler. It was originally written by @devos50
to crawl the BandwidthCommunity's data and was later adapted to serve
as just an example of a generic Tribler crawler.
"""
import argparse
import logging
Expand All @@ -8,29 +10,33 @@
from asyncio import ensure_future, get_event_loop
from pathlib import Path

from tribler.core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent
from tribler.core.components.ipv8.ipv8_component import Ipv8Component
from tribler.core.components.key.key_component import KeyComponent
from tribler.core.components.session import Session
from tribler.core.config.tribler_config import TriblerConfig
from tribler.core.utilities.utilities import make_async_loop_fragile


async def crawler_session(session_config: TriblerConfig):
session = Session(
config=session_config,
components=[
KeyComponent(),
Ipv8Component(),
# Put Your Component Here
])
signal.signal(signal.SIGTERM, lambda signum, stack: session.shutdown_event.set)
async with session:
await session.shutdown_event.wait()


class PortAction(argparse.Action):
def __call__(self, _, namespace, value, option_string=None):
if not 0 < value < 2 ** 16:
raise argparse.ArgumentError(self, "Invalid port number")
setattr(namespace, self.dest, value)


async def crawler_session(session_config: TriblerConfig):
session = Session(session_config,
[KeyComponent(), Ipv8Component(), BandwidthAccountingComponent(crawler_mode=True)])
signal.signal(signal.SIGTERM, lambda signum, stack: session.shutdown_event.set)
async with session:
await session.shutdown_event.wait()


if __name__ == "__main__":
parser = argparse.ArgumentParser(description=('Start a crawler in the bandwidth accounting community'))
parser.add_argument('--statedir', '-s', default='bw_crawler', type=str, help='Use an alternate statedir')
Expand All @@ -45,13 +51,10 @@ async def crawler_session(session_config: TriblerConfig):
config = TriblerConfig.load(state_dir=state_dir)

config.tunnel_community.enabled = False
config.libtorrent.enabled = False
config.bootstrap.enabled = False
config.chant.enabled = False
config.torrent_checking.enabled = False
config.api.http_enabled = True
config.api.http_port = args.restapi
config.bandwidth_accounting.outgoing_query_interval = 5

loop = get_event_loop()
if args.fragile:
Expand Down
2 changes: 0 additions & 2 deletions scripts/exit_node/run_exit_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from ipv8.util import run_forever

from tribler.core import notifications
from tribler.core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent
from tribler.core.components.ipv8.ipv8_component import Ipv8Component
from tribler.core.components.key.key_component import KeyComponent
from tribler.core.components.restapi.restapi_component import RESTComponent
Expand All @@ -33,7 +32,6 @@ def components_gen():
yield KeyComponent()
yield RESTComponent()
yield Ipv8Component()
yield BandwidthAccountingComponent()
yield TunnelsComponent()


Expand Down
1 change: 0 additions & 1 deletion src/run_tribler_headless.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ async def signal_handler(sig):
if options.testnet:
config.tunnel_community.testnet = True
config.chant.testnet = True
config.bandwidth_accounting.testnet = True

self.session = Session(config, components=list(components_gen(config)))
try:
Expand Down
Empty file.

This file was deleted.

Empty file.

This file was deleted.

Loading

0 comments on commit 959169e

Please sign in to comment.