Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (95 sloc) 4.28 KB
# Copyright (C) 2008-2018 Veselin Penev,
# This file ( is part of BitDust Software.
# BitDust is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# BitDust Software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with BitDust Software. If not, see <>.
# Please contact us if you have any questions at
from __future__ import absolute_import
import os
_KnownServers = None
def default_nodes():
A set of identity servers currently maintained, see file networks.json in the root folder.
from system import bpio
from system import local_fs
from lib import serialization
from main import settings
from logs import lg
networks_json = serialization.BytesToDict(
local_fs.ReadBinaryFile(os.path.join(bpio.getExecutableDir(), 'networks.json')))
my_network = local_fs.ReadTextFile(settings.NetworkFileName()).strip()
if not my_network:
my_network = 'main'
if my_network not in networks_json:
my_network = 'main'
network_info = networks_json[my_network]
identity_servers = {}
for identity_server in network_info['identity-servers']:
identity_servers[identity_server['host']] = (identity_server['http_port'], identity_server['tcp_port'], )'Active network is [%s] identity_servers=%s' % (my_network, identity_servers, ))
return identity_servers
def by_host():
Here is a well known identity servers to support the network.
Keys are domain names or global IP address (not recommended) of the ID server.
Values are ``Web port`` (reading) and ``TCP port`` (writing) numbers.
This is some kind of "genesis" network.
If you willing to support the project and started your own BitDust node on reliable machine,
contact us and we will include your address here.
So other nodes will be able to use your machine to host their identities.
You can override those "genesis" nodes by configuring list of your preferred identity servers
in the program settings:
This way you can create your own BitDust network, under your full control.
global _KnownServers
if _KnownServers is not None:
return _KnownServers
from main import config
overridden_identity_servers_str = str(config.conf().getData('services/identity-propagate/known-servers'))
overridden_identity_servers_str = ''
if not overridden_identity_servers_str:
_KnownServers = default_nodes()
return _KnownServers
overridden_identity_servers = {}
for id_server_str in overridden_identity_servers_str.split(','):
if id_server_str.strip():
id_server = id_server_str.strip().split(':')
id_server_host = id_server[0].strip()
id_server_web_port = int(id_server[1].strip())
id_server_tcp_port = int(id_server[2].strip())
overridden_identity_servers[id_server_host] = (id_server_web_port, id_server_tcp_port, )
if overridden_identity_servers:
from logs import lg'Identity servers was overridden in local settings: %s' % overridden_identity_servers)
_KnownServers = overridden_identity_servers
return _KnownServers
_KnownServers = default_nodes()
return _KnownServers