AddPeer
This is a message of the Freenet Client Protocol 2.0 (FCP 2.0).
It is sent from a client program to the Freenet node.
It adds a peer to the Freenet node. The message should contain only one of a File, URL or a raw Node reference. Your own node reference is found in a file called node-port, where port is the UDP port number than 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 was 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.
Example
AddPeer File=newref.txt EndMessage
AddPeer URL=http://foobar.net/myref.txt EndMessage
AddPeer 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
| Field | Possible values | Mandatory? | Default | Description |
|---|---|---|---|---|
| The following three options are mutually exclusive | ||||
| 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. | |