Example #1
0
def test_node_lookup():
    target_id = utility.default_id
    n = Node(1000)
    n.load_kbucket('nodeA.csv')
    x = n._node_lookup(target_id)
    print('node lookup answer:', x)
    for triple in x:
        print(utility.distance(triple.id, target_id))
Example #2
0
def test_store_file():
    target_id = utility.default_id
    n = Node(1000)
    n.load_kbucket('nodeA.csv')
    x = n.store_file(
        'file.txt',
        r'C:\Users\roykc\Documents\Projects\d-p2p-fsn\tests\file.txt')
    print('in my shared files: ', n.my_shared_files)
Example #3
0
def test_node(port):
    n = Node(port)
    index = int(port / 1000) - 1
    abc = 'ABCDEFGHIJ'
    print(abc[index])
    n.load_kbucket('node' + abc[index] + '.csv')
Example #4
0
import json

from classes.Node import Node
from gui.gui import *

if __name__ == '__main__':
    with open('config.json') as config_file:
        data = json.load(config_file)

    port = data['port']
    kbucket = data['kbucket']

    n = Node(port)
    n.load_kbucket(kbucket)
    vp_start_gui(n)
Example #5
0
def download(file_name):
    n = Node(3999)
    n.load_kbucket('nodeD.csv')
    n.download(file_name)