Skip to content
David Roden edited this page Mar 30, 2017 · 1 revision

AddPeer adds a peer to the Freenet node.

The message should contain only one of

Your own node reference is found in a file called node-port, where port is the UDP port number that Freenet is using. The node references of your peers are found in the file called peers-port.

The node will respond with a Peer message when the peer is added successfully, or a ProtocolError message if the peer could not be added.

Important Note

Care must be taken to ensure that any automated connection system maintains the correct "network topology", otherwise Freenet's overall performance could deteriorate dramatically. Connections must be "clustered" in such a way that if node A is connect to node B, and node B is connect to node C, then there must be a higher than normal probability that node A is connected to node C. Human relationships have this property, but simply connecting together nodes at random will not, and will result in serious problems for the Freenet network. You can achieve a good network topology if you try to ensure that the probability of two nodes being connected is proportional to the inverse of the distance between the node's locations - noting that locations are on a ring, where 0.0 is the same as 1.0 (in the same way that zero o'clock is the same as twelve o'clock). If you are implementing anything that uses AddPeer, and you are unclear about this issue, please seek guidance on the tech mailing list before you proceed.

Examples

 AddPeer
 Trust=HIGH
 Visibility=YES
 File=newref.txt
 EndMessage
 AddPeer
 Trust=NORMAL
 Visibility=NAME_ONLY
 URL=http://foobar.net/myref.txt
 EndMessage
 AddPeer
 Trust=LOW
 Visibility=NO
 physical.udp=12.34.56.78:12345
 lastGoodVersion=Fred,0.7,1.0,874
 ark.pubURI=SSK@fjRw9dk...AQABAAE/ark
 ark.number=123
 identity=GT5~dseFDw...
 myName=foobar
 base64=true
 location=0.01234567890
 testnet=false
 version=Fred,0.7,1.0,918
 EndMessage

Details

Field Possible values Mandatory Default Description
Trust LOW, NORMAL, HIGH yes Sets the trust you put in the new peer.
Visibility NO, NAME_ONLY, YES yes Determines whether the new peer will be visible for your peers.
File filename no If set, the peer noderef is read from the given filename relative to the node's current directory.
URL URL no If set, the peer noderef is read from the given URL.
<raw_noderef> <key>=<value> no If neither File nor URL are set, the field set is read as a noderef.

Note: Only one of the above sources for a peer is allowed to be present in this message.

Clone this wiki locally