Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial draft of protocol spec #27

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions protocol-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#IPFS Protocol Specification

The purpose of this document is to lay out the structure of all messages sent by ipfs.
This includes the structure and types for all data sent over the network.

##DHT Messages
All DHT Messages are wrapped in a protobuf message structure as defined [over here](https://github.com/jbenet/go-ipfs/blob/dht/routing/dht/messages.proto) (currently only in dht branch).
Every message includes a unique message ID. This is used to identify responses to requests that are sent out, a response will have the same message ID as the request.

The fields are commonly overloaded to mean different things depending on which message type is being sent.

### Put
Type Value: 0

Request:

Key and Value are a common Key Value pair for insertion into the DHT.


Response:

Put has no response message

### Get
Type Value: 1

Key is the key being requested.


Response:

On success:

Value is the value for the requested key

On Failure:

Peers will contain a list of peers closer to the requested key


### Add Provider
Type Value: 2

Key represents the value that the sender is announcing that they can provide

Response:

Add provider has no response message

### Get Providers
Type Value: 3

Key is the value that the sender is looking for providers of.

Response:

Peers is an array of Peer IDs and Multiaddrs (See messages.proto)

### Find Peer
Type Value: 4

Key is the peer ID of the peer the sender is searching for

Response:

Peers will contain the closest peer the receiver has to the requested peer.
The Success variable will indicate if the peer was found or not.

### Ping
Type Value: 5

No Extra fields used.