Git Product home page Git Product logo

Comments (7)

anacrolix avatar anacrolix commented on May 28, 2024

Could you provide the command you ran, and possibly a link to a way for me to reproduce this?

from torrent.

anacrolix avatar anacrolix commented on May 28, 2024

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.

tanishbajaj101 avatar tanishbajaj101 commented on May 28, 2024

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.

tanishbajaj101 avatar tanishbajaj101 commented on May 28, 2024

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.

anacrolix avatar anacrolix commented on May 28, 2024

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.

anacrolix avatar anacrolix commented on May 28, 2024

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.

anacrolix avatar anacrolix commented on May 28, 2024

I'll close, I'm not sure how else I can help.

from torrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.