Package Anomos :: Module NetworkModel :: Class NetworkModel
[hide private]
[frames] | no frames]

Class NetworkModel

source code

Simple Graph model of network

Instance Methods [hide private]
 
__init__(self, config) source code
SimPeer
get(self, peerid)
Returns: SimPeer object corresponding to name or None if nonexistant
source code
 
getSwarm(self, infohash) source code
 
getDownloadingPeers(self, infohash) source code
 
getSeedingPeers(self, infohash) source code
SimPeer
initPeer(self, peerid, pubkey, ip, port, sid, num_neighbors=4)
Returns: a reference to the created peer
source code
 
connect(self, v1, v2)
Creates connection between two nodes and selects Neighbor ID (NID).
source code
 
randConnect(self, peerid, numpeers)
Assign 'numpeers' many randomly selected neighbors to peer with id == peerid
source code
 
disconnect(self, peerid)
Removes designated peer from network
source code
 
nbrsOf(self, peerid) source code
 
getPathsToFile(self, src, infohash, how_many=5, is_seed=False, minhops=3) source code
 
getTrackingCodes(self, source, infohash, count=3) source code
string
encryptTC(self, pathByNames, prevNbr=None, plaintext='#', msglen=4096)
Returns an encrypted tracking code
source code
Method Details [hide private]

get(self, peerid)

source code 
Parameters:
  • peerid (string)
Returns: SimPeer
SimPeer object corresponding to name or None if nonexistant

initPeer(self, peerid, pubkey, ip, port, sid, num_neighbors=4)

source code 
Parameters:
  • pubkey (Anomos.Crypto.RSAPubKey) - public key to use when encrypting to this peer
  • peerid (string)
Returns: SimPeer
a reference to the created peer

connect(self, v1, v2)

source code 

Creates connection between two nodes and selects Neighbor ID (NID).

Parameters:
  • v1 (string) - Peer ID
  • v2 (string) - Peer ID

disconnect(self, peerid)

source code 

Removes designated peer from network

Parameters:
  • peerid - Peer ID (str) of peer to be removed

encryptTC(self, pathByNames, prevNbr=None, plaintext='#', msglen=4096)

source code 

Returns an encrypted tracking code

Parameters:
  • pathByNames (list) - List of peer id's belonging to members of chain
  • plaintext (str) - Message to be encrypted at innermost onion layer.
Returns: string
E_a(\x0 + SID_a + TC_b + E_b(\x0 + SID_b + TC_c + \ E_c(\x1 + SID_c + plaintext)))

See Also: http://anomos.info/wp/2008/06/19/tracking-codes-revised/