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))
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)
def test_node(port): n = Node(port) index = int(port / 1000) - 1 abc = 'ABCDEFGHIJ' print(abc[index]) n.load_kbucket('node' + abc[index] + '.csv')
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)
def download(file_name): n = Node(3999) n.load_kbucket('nodeD.csv') n.download(file_name)