Skip to content

Commit

Permalink
Split Master Key Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Oct 18, 2021
1 parent 9e4e802 commit 1921756
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 42 deletions.
39 changes: 39 additions & 0 deletions src/tribler-core/tribler_core/components/ipv8/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from typing import Optional

from pydantic import validator

from tribler_common.network_utils import NetworkUtils
from tribler_core.config.tribler_config_section import TriblerConfigSection


# pylint: disable=no-self-argument


class BootstrapSettings(TriblerConfigSection):
enabled: bool = True
max_download_rate: int = 1000000
infohash: str = 'b496932f32daad964e1b63188faabf74d22b45ea'


class Ipv8Settings(TriblerConfigSection):
enabled: bool = True
port: int = 7759
address: str = '0.0.0.0'
bootstrap_override: Optional[str] = None
statistics: bool = False
walk_interval: float = 0.5
walk_scaling_enabled: bool = True
walk_scaling_upper_limit: float = 3.0

@validator('port')
def validate_port(cls, v):
assert 0 <= v <= NetworkUtils.MAX_PORT, 'Port must be in range [0..65535]'
return v


class DiscoveryCommunitySettings(TriblerConfigSection):
enabled: bool = True


class DHTSettings(TriblerConfigSection):
enabled: bool = True
39 changes: 1 addition & 38 deletions src/tribler-core/tribler_core/components/masterkey/settings.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,9 @@
from typing import Optional

from pydantic import Field, validator

from tribler_common.network_utils import NetworkUtils
from pydantic import Field

from tribler_core.config.tribler_config_section import TriblerConfigSection


# pylint: disable=no-self-argument
class BootstrapSettings(TriblerConfigSection):
enabled: bool = True
max_download_rate: int = 1000000
infohash: str = 'b496932f32daad964e1b63188faabf74d22b45ea'


class Ipv8Settings(TriblerConfigSection):
enabled: bool = True
port: int = 7759
address: str = '0.0.0.0'
bootstrap_override: Optional[str] = None
statistics: bool = False
walk_interval: float = 0.5
walk_scaling_enabled: bool = True
walk_scaling_upper_limit: float = 3.0

@validator('port')
def validate_port(cls, v):
assert 0 <= v <= NetworkUtils.MAX_PORT, 'Port must be in range [0..65535]'
return v


class DiscoveryCommunitySettings(TriblerConfigSection):
enabled: bool = True


class DHTSettings(TriblerConfigSection):
enabled: bool = True


class TrustchainSettings(TriblerConfigSection):
Expand All @@ -44,8 +12,3 @@ class TrustchainSettings(TriblerConfigSection):
testnet_keypair_filename: str = 'ec_trustchain_testnet.pem'
alter_keypair_filename: str = 'secondary_key.pem'
testnet: bool = Field(default=False, env='TRUSTCHAIN_TESTNET')


class WatchFolderSettings(TriblerConfigSection):
enabled: bool = False
directory: str = ''
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings
from tribler_core.components.gigachannel.community.settings import ChantSettings
from tribler_core.components.ipv8.settings import BootstrapSettings, DHTSettings, DiscoveryCommunitySettings, \
Ipv8Settings
from tribler_core.components.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings
from tribler_core.components.masterkey.settings import BootstrapSettings, DHTSettings, DiscoveryCommunitySettings, \
Ipv8Settings, \
TrustchainSettings, WatchFolderSettings
from tribler_core.components.masterkey.settings import TrustchainSettings
from tribler_core.components.popularity.settings import PopularityCommunitySettings
from tribler_core.components.resource_monitor.settings import ResourceMonitorSettings
from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings
from tribler_core.modules.torrent_checker.settings import TorrentCheckerSettings
from tribler_core.modules.tunnel.community.settings import TunnelCommunitySettings
from tribler_core.modules.watch_folder.settings import WatchFolderSettings
from tribler_core.restapi.settings import APISettings
from tribler_core.settings import ErrorHandlingSettings, GeneralSettings

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from tribler_common.network_utils import NetworkUtils
from tribler_core.components.masterkey.settings import Ipv8Settings
from tribler_core.components.ipv8.settings import Ipv8Settings


@pytest.mark.asyncio
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from tribler_core.config.tribler_config_section import TriblerConfigSection


# pylint: disable=no-self-argument


class WatchFolderSettings(TriblerConfigSection):
enabled: bool = False
directory: str = ''

0 comments on commit 1921756

Please sign in to comment.