Ejemplo n.º 1
0
def get_edges_for_peers(edges, peers, node_ip):
    for peer_key in peers:
        peer_ip = key_utils.to_ipv6(peer_key)

        A = max(node_ip, peer_ip)
        B = min(node_ip, peer_ip)

        edge = {'a': A, 'b': B}

        if A not in edges:
            edges[A] = []

        if not any(edge['b'] == B for edge in edges[A]):
            edges[A].append(edge)
Ejemplo n.º 2
0
def get_edges_for_peers(edges, peers, node_ip):
    for peer_key in peers:
        peer_ip = key_utils.to_ipv6(peer_key)

        A = max(node_ip, peer_ip)
        B = min(node_ip, peer_ip)

        edge = { 'a': A,
                 'b': B }

        if A not in edges:
            edges[A] = []

        if not any(edge['b'] == B for edge in edges[A]):
            edges[A].append(edge)
Ejemplo n.º 3
0
Archivo: sGNG.py Proyecto: kyrias/bin
def get_edges_for_peers(edges, peers, node_ip):
	for peer_key in peers:
		peer_ip = key_utils.to_ipv6(peer_key)

		if node_ip > peer_ip:
			A = node_ip
			B = peer_ip
		else:
			A = peer_ip
			B = node_ip

		edge = { 'A': A,
				 'B': B }

		if A not in edges:
			edges[A] = []

		if not([True for edge in edges[A] if edge['B'] == B]):
			edges[A] += [edge]
Ejemplo n.º 4
0
def get_edges_for_peers(edges, peers, node_ip):
    for peer_key in peers:
        peer_ip = key_utils.to_ipv6(peer_key)

        if node_ip > peer_ip:
            A = node_ip
            B = peer_ip
        else:
            A = peer_ip
            B = node_ip

        edge = { 'a': A,
                 'b': B }

        if A not in edges:
            edges[A] = []

        if not([True for edge in edges[A] if edge['b'] == B]):
            edges[A] += [edge]
Ejemplo n.º 5
0
nodedb_data_unclean = urllib2.urlopen("https://raw.githubusercontent.com/zielmicha/nodedb/master/nodes")
nodedb_data = nodedb_data_unclean.readlines()
nodedb_data.pop(0)

nodedb_reference_table = {}
for x in nodedb_data:
	nodedb_reference_table[x.split()[0]] = x.split()[1]

cjdns = cjdns.connect("127.0.0.1", 11234, "NONE")

peerStats = cjdns.InterfaceController_peerStats()

list_of_Nodes = []
for x in peerStats['peers']:
	list_of_Nodes.append(key_utils.to_ipv6(x['publicKey']))

Title = "# Virtualhacker - Cjdns public node\n"
date_stamp = "__Last Updated:__ " + time.strftime("%Y-%m-%d, %R")

with open("/var/www/virtualhacker.net/pages/peerstats.md","w") as handle:
	handle.write(Title)
	handle.write(date_stamp + "  \n")
	handle.write("  \n")
	handle.write("To join this Node, information can be found [here](/?pages=services#cjdns)  \n")
	handle.write("  \n")
	handle.write("### Connected Peers  \n")
	handle.write("  \n")
	for x in list_of_Nodes:
		if x in nodedb_reference_table:
			handle.write(x + " - _" + nodedb_reference_table[x] + "_  \n")
Ejemplo n.º 6
0
nodedb_data_unclean = urllib2.urlopen(
    "https://raw.githubusercontent.com/zielmicha/nodedb/master/nodes")
nodedb_data = nodedb_data_unclean.readlines()
nodedb_data.pop(0)

nodedb_reference_table = {}
for x in nodedb_data:
    nodedb_reference_table[x.split()[0]] = x.split()[1]

cjdns = cjdns.connect("127.0.0.1", 11234, "NONE")

peerStats = cjdns.InterfaceController_peerStats()

list_of_Nodes = []
for x in peerStats['peers']:
    list_of_Nodes.append(key_utils.to_ipv6(x['publicKey']))

Title = "# Virtualhacker - Cjdns public node\n"
date_stamp = "__Last Updated:__ " + time.strftime("%Y-%m-%d, %R")

with open("/var/www/virtualhacker.net/pages/peerstats.md", "w") as handle:
    handle.write(Title)
    handle.write(date_stamp + "  \n")
    handle.write("  \n")
    handle.write(
        "To join this Node, information can be found [here](/?pages=services#cjdns)  \n"
    )
    handle.write("  \n")
    handle.write("### Connected Peers  \n")
    handle.write("  \n")
    for x in list_of_Nodes: