Jesse Li
e0f58e0b16
Merge pull request #10 from yeung66/patch-1
...
fix: change port used in buildTrackerURL
2023-02-15 15:12:03 -05:00
YeungYeah
ab1aeff121
fix: expected port in test
2022-04-10 20:36:44 +08:00
YeungYeah
94a3f930cb
fix: change port used in buildTrackerURL
...
variable port should use port from parameter instead of a const Port
2022-04-10 20:16:44 +08:00
Jesse Li
d51be59e2c
Merge pull request #7 from uxlsl/master
...
fix shift count type int, must be unsigned integer
2021-02-22 22:51:44 -05:00
linsonglin
463431dd71
fix shift count type int, must be unsigned integer
2021-02-23 11:04:04 +08:00
Jesse Li
457c84954e
Merge pull request #4 from antontomusiak/master
...
Handle keep-alive in recvBitfield
2020-09-28 08:35:51 -04:00
anton
7b89866bbd
Handle keep-alive in recvBitfield
2020-09-28 14:11:01 +03:00
Jesse
a83013d250
Rewrite handshake Serialize
2020-01-12 09:17:19 -05:00
Jesse Li
439a0e19a8
Update README.md
2020-01-04 18:34:56 -05:00
Jesse Li
2bde944888
Update README.md
2020-01-04 14:06:43 -05:00
Jesse Li
2768f3ea3d
Remove buffering from results channel
2020-01-04 11:01:01 -05:00
Jesse Li
09818dfa78
Implement peer String() method
2020-01-03 13:04:16 -05:00
Jesse Li
a8225373e7
Update README.md
2020-01-02 21:49:21 -05:00
Jesse Li
8aa4a57933
Add circleci file
2020-01-02 21:42:44 -05:00
Jesse Li
67d6a6808c
Test the client
2020-01-02 21:28:15 -05:00
Jesse Li
b59125b5b7
Rip out reader code
2020-01-02 19:36:25 -05:00
Jesse Li
e9edc62c57
Split client into its own package
2020-01-02 15:34:25 -05:00
Jesse Li
f46d43985a
Test tracker
2020-01-02 13:07:59 -05:00
Jesse Li
0050772d42
Update handshake comments
2020-01-02 12:31:41 -05:00
Jesse Li
669f15ec75
Remove support for MsgPort
2020-01-02 12:30:17 -05:00
Jesse Li
81a6437145
More informative comments for message IDs
2020-01-02 12:29:10 -05:00
Jesse Li
b3beb5ed2a
Check infohash in handshake
2020-01-02 12:26:54 -05:00
Jesse Li
b3ee9f4117
Use clearer names for functions that send messages
2020-01-02 12:23:22 -05:00
Jesse Li
b255ecc574
Fix torrentfile TestOpen
2020-01-02 12:20:41 -05:00
Jesse Li
b3299a6bfa
Simplify download interface
2020-01-02 12:17:45 -05:00
Jesse Li
06b849a44d
Fix bug which produced incorrect piece size
2020-01-02 11:49:08 -05:00
Jesse Li
873008bb96
Caveat that Download stores the file in memory
2020-01-02 10:51:13 -05:00
Jesse Li
22fc59dae3
Small refactor of downloadState
...
Renames the struct to pieceProgress and makes readMessage/readMessages
methods of the struct instead of arguments, to make it a little bit
clearer that they modify the struct in-place.
2020-01-02 10:47:02 -05:00
Jesse Li
d4f6d1265d
Check error in request to client
2020-01-02 10:44:08 -05:00
Jesse Li
70713e028d
Fix race condition
...
The download loop might finish and kill the worker goroutine before it's
done sending HAVE messages. Switching the order of these two lines
trivially fixes the issue (but it's still brittle)
2020-01-02 10:41:24 -05:00
Jesse Li
73a9a5216b
Break p2p.Peer and parsePeers into its own package
2020-01-02 10:39:35 -05:00
Jesse Li
25810161eb
Add timeout to tracker GET request
2020-01-02 10:34:47 -05:00
Jesse Li
17e57b6dd6
Rename getPeers to requestPeers
2020-01-02 10:32:20 -05:00
Jesse Li
cc088e8b79
Only use fmt.Errorf
2020-01-02 10:30:30 -05:00
Jesse Li
4f6a2eb20e
Make peerSize a const
2020-01-02 10:28:58 -05:00
Jesse Li
4fd40f9f0a
Return plain struct from toTorrentFile
2020-01-02 10:27:00 -05:00
Jesse Li
7e8b3413ac
Check error in getPeers
2020-01-02 10:23:18 -05:00
Jesse Li
f746beb9d6
Remove log in torrentfile
2020-01-02 10:22:52 -05:00
Jesse Li
9c6bf79e61
Rename toTorrent to toTorrentFile
2019-12-31 23:36:27 -05:00
Jesse Li
acd4fe9c62
Implement golden file test for torrentfile.Open
2019-12-31 12:18:18 -05:00
Jesse Li
a5e2137e37
Update README.md
2019-12-30 10:56:35 -05:00
Jesse
487337a08a
Add bounds checking to bitfield
...
This way, we don't panic when we get an invalid HAVE message
2019-12-30 10:34:43 -05:00
Jesse
402e4e1665
Correct the size of a piece
...
Previously confused piece vs block
2019-12-30 10:23:15 -05:00
Jesse
928bbfeab4
Simplify download algorithm
2019-12-30 10:21:26 -05:00
Jesse
46b55339aa
Fix unit in comment about block size
2019-12-29 22:47:32 -05:00
Jesse
23f3a144af
Add logging around tracker and number of peers
2019-12-29 21:59:33 -05:00
Jesse
67066ad77c
Set 30 second deadline for pieces to download
2019-12-29 21:44:07 -05:00
Jesse
c4fbd50021
Make MaxBlockSize and MaxBacklog public
2019-12-29 20:59:10 -05:00
Jesse Li
92974b393a
Update README.md
2019-12-29 20:54:51 -05:00
Jesse Li
6d7c786022
Create LICENSE
2019-12-29 20:47:44 -05:00