-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
package torrent | ||
|
||
func Download(tf *TorrentFile, peerId [20]byte, peers []PeerInfo) error { | ||
type TorrentTask struct { | ||
PeerId [20]byte | ||
PeerList []PeerInfo | ||
InfoSHA [SHALEN]byte | ||
FileName string | ||
FileLen int | ||
PieceLen int | ||
PieceSHA [][SHALEN]byte | ||
} | ||
|
||
func Download(task *TorrentTask) error { | ||
//TODO: check local tmp file | ||
//TODO: download piceces and check | ||
//TODO: write picece bytes into local tmp file | ||
return nil | ||
} | ||
|
||
func MakeFile(tf *TorrentFile) { | ||
func MakeFile(name string) { | ||
//TODO: assemble tmp to file | ||
} |