Created
November 17, 2013 20:02
-
-
Save jaytaph/7517596 to your computer and use it in GitHub Desktop.
telehash xfer app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All application packets are marked with the "_xfer" type. | |
Returning a listing of all files from a particular node: | |
Request: | |
{ | |
type : '_xfer', | |
_ : { | |
request : 'list' | |
} | |
} | |
Response: | |
{ | |
type : '_xfer', | |
_ : { | |
response : 'list' | |
} | |
} | |
body: | |
filename|sha1|size\n | |
filename|sha1|size\n | |
filename|sha1|size\n | |
... | |
filename|sha1|size\n | |
Seek a certain file from aparticular node: | |
Request: | |
{ | |
type : '_xfer', | |
_ : { | |
request : 'seek', | |
file : <filename> | |
} | |
} | |
Response: | |
{ | |
type : '_xfer', | |
_ : { | |
response : 'seek', | |
file : <filename>, | |
sha1 : <sha1sum of the file>, | |
size : <size of the file in bytes> | |
} | |
} | |
Seek a certain file from aparticular node: | |
Request: | |
{ | |
type : '_xfer', | |
_ : { | |
request : 'retrieve', | |
file : <filename>, | |
block: <id> | |
} | |
} | |
Response: | |
{ | |
type : '_xfer', | |
_ : { | |
response : 'retrieve', | |
file : <filename>, | |
block : <id>, | |
sha1 : <sha1sum of the block> | |
} | |
} | |
body: | |
<binary block> | |
A block is 1KB (1024 bytes) in size. A file of 5KB thus needs 5 retrieve packets in order to download the file. The last block can hold less data if the file isn't padded to exactly 1kb. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment