android torrent library
Go torrent library with nice and simple interface. Can be used as standart Go library or gomobile library (iOS / Android)
Base Features (https://github.com/anacrolix/torrent):
Additional features:
# git clone https://gitlab.com/axet/torrent $GOPATH/src/github.com/anacrolix/torrent
# go get -u gitlab.com/axet/libtorrent
# go tool cgo libtorrent.go
Use within your android gralde project:
# gomobile bind -o libtorrent.aar gitlab.com/axet/libtorrent
Then import your libtorrent.arr into Android Studio or Eclipse.
package main
import (
"log"
"time"
"gitlab.com/axet/libtorrent"
)
func createTorrentFileExample() {
t1 := libtorrent.CreateTorrentFile("/Users/axet/Downloads/Prattchet")
ioutil.WriteFile("./test.torrent", t1, 0644)
}
func downloadMagnetWaitExample() {
libtorrent.Create()
t1 := libtorrent.AddMagnet("/tmp", "magnet:?...")
libtorrent.StartTorrent(t1)
libtorrent.WaitAll()
log.Println("done")
libtorrent.Close()
}
func downloadMagnetStatusExample() {
libtorrent.Create()
t1 := libtorrent.AddMagnet("/tmp", "magnet:?...")
libtorrent.StartTorrent(t1)
for libtorrent.TorrentStatus(t1) == libtorrent.StatusDownloading {
time.Sleep(100 * time.Millisecond)
log.Println("loop")
}
log.Println("done")
libtorrent.Close()
}