Exemplo n.º 1
0
from crochet import setup

# start twisted via crochet and remove twisted handler
setup()
signal.signal(signal.SIGINT, signal.default_int_handler)

_log = logging.getLogger(__name__)

WALK_TIMEOUT = WALK_TIMEOUT / 2.0


SWARM_SIZE = 32
MAX_MESSAGES = 2
PORT = 3000
STORAGE_DIR = tempfile.mkdtemp()
WAN_IP = get_wan_ip()


class TestNode(unittest.TestCase):

    @classmethod
    def setUpClass(cls):

        # start profiler
        cls.profile = cProfile.Profile()
        cls.profile.enable()

        # create swarm
        print("TEST: creating swarm")
        cls.btctxstore = btctxstore.BtcTxStore(testnet=False)
        cls.swarm = []
Exemplo n.º 2
0
bootstrap_nodes = [("127.0.0.1", 1337)]

# Create nodes.
node_no = 2
nodes = []
for i in range(0, node_no):
    # Create node.
    btctxstore = BtcTxStore(testnet=False)
    node = storjnode.network.Node(
        btctxstore.create_wallet(), port=1339 + i, ksize=8,
        bootstrap_nodes=[("127.0.0.1", 1337)],
        refresh_neighbours_interval=0.0,
        store_config={tempfile.mkdtemp(): None},
        nat_type="preserving",
        node_type="passive",
        wan_ip=get_wan_ip(),
        passive_port=10500 + i,
        disable_data_transfer=False,
        simulate_dht=True
    )

    # Record node.
    nodes.append(node)


# Test get UNL.
def callback(unl):
    print("GOT UNL!")
    print(unl)

# Output UNL when nodes respond.
Exemplo n.º 3
0
from storjnode.network.server import QUERY_TIMEOUT, WALK_TIMEOUT
from crochet import setup

# start twisted via crochet and remove twisted handler
setup()
signal.signal(signal.SIGINT, signal.default_int_handler)

_log = logging.getLogger(__name__)

WALK_TIMEOUT = WALK_TIMEOUT / 2.0

SWARM_SIZE = 32
MAX_MESSAGES = 2
PORT = 3000
STORAGE_DIR = tempfile.mkdtemp()
WAN_IP = get_wan_ip()


class TestNode(unittest.TestCase):
    @classmethod
    def setUpClass(cls):

        # start profiler
        cls.profile = cProfile.Profile()
        cls.profile.enable()

        # create swarm
        print("TEST: creating swarm")
        cls.btctxstore = btctxstore.BtcTxStore(testnet=False)
        cls.swarm = []
        for i in range(SWARM_SIZE):