Comments (7)
Could you provide the command you ran, and possibly a link to a way for me to reproduce this?
from torrent.
There was some prior work done to export to Java, I think there might be some overlap in what is required. See https://github.com/arranlomas/Trickl and @axet's https://gitlab.com/axet/android-torrent-client.
from torrent.
Could you provide the command you ran, and possibly a link to a way for me to reproduce this?
go build -buidlmode=c-shared -o /tmp/torrent_download ./cmd/torrent
I ran this command from main directory where go.mod file was there
from torrent.
hey @anacrolix I have decided to code the torrent client in Dart itself rather use any bindings, I have found a library that can download and seed the torrent, but I want to add a feature to 'create' the torrent from a local file as well. Can you tell me the logic behind creating the torrent?
My understanding till now is that I would need a dictionary (info) that would have data like name, length (in bytes) of file, number of pieces, piece size, etc. and this would be bencoded and then hashed using SHA1.
When I opened libtorrent docs and your code, I found a keyword 'offset' which I'm not sure what it means
Also a major uncertainity I have is how I would divide a local file into its pieces and make SHA1 of each piece. How would that be made possible? Do i do a file_length/piece_size or something else?
Edit: I think I understood some of it using pieces.go file from your code
func GeneratePieces(r io.Reader, pieceLength int64, b []byte) ([]byte, error) {
for {
h := sha1.New()
written, err := io.CopyN(h, r, pieceLength)
if written > 0 {
b = h.Sum(b)
}
if err == io.EOF {
return b, nil
}
if err != nil {
return b, err
}
}
}
But please tell me all you can as I don't have much prior experience here
from torrent.
Could you provide the command you ran, and possibly a link to a way for me to reproduce this?
go build -buidlmode=c-shared -o /tmp/torrent_download ./cmd/torrent I ran this command from main directory where go.mod file was there
This command ran without error on my system. darwin/arm64.
from torrent.
hey @anacrolix I have decided to code the torrent client in Dart itself rather use any bindings, I have found a library that can download and seed the torrent, but I want to add a feature to 'create' the torrent from a local file as well. Can you tell me the logic behind creating the torrent? My understanding till now is that I would need a dictionary (info) that would have data like name, length (in bytes) of file, number of pieces, piece size, etc. and this would be bencoded and then hashed using SHA1. When I opened libtorrent docs and your code, I found a keyword 'offset' which I'm not sure what it means Also a major uncertainity I have is how I would divide a local file into its pieces and make SHA1 of each piece. How would that be made possible? Do i do a file_length/piece_size or something else?
Edit: I think I understood some of it using pieces.go file from your code func GeneratePieces(r io.Reader, pieceLength int64, b []byte) ([]byte, error) { for { h := sha1.New() written, err := io.CopyN(h, r, pieceLength) if written > 0 { b = h.Sum(b) } if err == io.EOF { return b, nil } if err != nil { return b, err } } } But please tell me all you can as I don't have much prior experience here
Sorry I don't have the bandwidth to assist with other projects.
from torrent.
I'll close, I'm not sure how else I can help.
from torrent.
Related Issues (20)
- Prioritize the use of local peers HOT 1
- Slow downloads while multiple large torrents are being downloaded. HOT 25
- panic: net/http: internal error: connCount underflow HOT 9
- listen tcp6 :42069: socket: address family not supported by protocol HOT 3
- ICE Servers config doesn't support authentication for TURN servers HOT 1
- hign cpu usage of sha1.blockAMD64 HOT 8
- Cannot download file from a not completed peer HOT 5
- Can't build [email protected] with go1.20 HOT 2
- Cannot use download subcmd to download what i seed torrent HOT 6
- Ignore malformed (optional) fields in metainfo.Load
- ratelimireader.go panic HOT 2
- Does repo support to build private dht bootstrap server? HOT 1
- Error tracking HOT 1
- Add mention of Torrent-WebDAV HOT 1
- missing package 'main' when trying to build it as Go library HOT 1
- how to ban client ? HOT 2
- Missing projects using this library HOT 9
- Memory stays high after dropping torrent HOT 10
- Small torrents with sparse seeding not completing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent.