libtorrent

package module
v0.0.0-...-d8763f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2023 License: BSD-3-Clause Imports: 2 Imported by: 2

README

libtorrent-go

SWIG Go bindings for libtorrent-rasterbar

Forked from https://github.com/steeve/libtorrent-go and https://github.com/scakemyer/libtorrent-go

C/C++ Cross compiling environment containers

This has been designed to run libtorrent-go cross compilation and is not meant to be perfect nor minimal. Adapt as required.

Overview

Environment variables
  • CROSS_TRIPLE
  • CROSS_ROOT
  • LD_LIBRARY_PATH
  • PKG_CONFIG_PATH
Installed packages

Based on Debian Stretch:

  • bash
  • curl
  • wget
  • pkg-config
  • build-essential
  • make
  • automake
  • autogen
  • libtool
  • libpcre3-dev
  • bison
  • yodl
  • tar
  • xz-utils
  • bzip2
  • gzip
  • unzip
  • file
  • rsync
  • sed
  • upx

And a selection of platform specific packages (see below).

Platforms built
  • android-arm (android-ndk-r14b with api 19, clang)
  • android-arm64 (android-ndk-r14b with api 21, clang)
  • android-x64 (android-ndk-r14b with api 21, clang)
  • android-x86 (android-ndk-r14b with api 21, clang)
  • darwin-x64 (clang-4.0, llvm-4.0-dev, libtool, libxml2-dev, uuid-dev, libssl-dev patch make cpio)
  • darwin-x86 (clang-4.0, llvm-4.0-dev, libtool, libxml2-dev, uuid-dev, libssl-dev patch make cpio)
  • linux-armv6 (gcc-9 with Musl)
  • linux-armv7 (gcc-9 with Musl)
  • linux-arm64 (gcc-9 with Musl)
  • linux-x64 (gcc-9 with Musl)
  • linux-x86 (gcc-9 with Musl)
  • windows-x64 (mingw-w64)
  • windows-x86 (mingw-w64)
Software
  • BOOST_VERSION = 1.69.0
  • OPENSSL_VERSION = 1.1.1b
  • SWIG_VERSION = f042543c6f87cd1598495d23e0afa16d2f4775ed
  • GOLANG_VERSION = 1.12.5
  • LIBTORRENT_VERSION = 6f1250c6535730897909240ea0f4f2a81937d21a

Download and Build

  • First, you need Docker and golang

  • Create Go home folder and set $GOPATH environment variable:

      mkdir ~/go
      export GOPATH=~/go
    
  • Download libtorrent-go:

      go get github.com/ElementumOrg/libtorrent-go
      cd ~/go/src/github.com/ElementumOrg/libtorrent-go
    
  • Pull the cross-compiler image for your platform:

      make pull PLATFORM=android-arm
    
  • Next, you need to prepare Docker environments. You can do it with two ways:

      make envs
    

    This will download and build all needed development packages and could take hours. But it can be necessary if you want to make your own customizations.

    You can also prepare specific environments like so:

      make env PLATFORM=android-arm
    
  • (Optionally) Build locally without Docker (for local development, for example)

    Is helpful if you need to have all the required stack locally on your OS. You need to specify CROSS_TRIPLE - you can find possible values here. Everything is installed in libtorrent-go/local-env/ directory.

      make local-env CROSS_TRIPLE=x86_64-linux-gnu
    

    Then you can run libtorrent-go module compilation:

      make re TARGET_OS=linux TARGET_ARCH=x64 CROSS_ROOT=local-env
    

    It will make sure to use libtorrent-go/local-env/lib/pkgconfig/ to compile module and have all the dependencies. But before that you also need to install swig.

  • Build libtorrent-go:

      make [ android-arm | android-arm64 | android-x86 | android-x64 |
             linux-x86   | linux-x64     | linux-armv6 | linux-armv7 | linux-arm64 |
             windows-x86 | windows-x64   | 
             darwin-x64  | darwin-x86 ]
    

    To build libtorrent bindings for all platforms use make or specify needed platform, e.g. make android-arm. Built packages will be placed under ~/go/pkg/<platform>

Release

Release is done by running release.sh script, that compiles all Docker images and pushes them to Docker Hub.

Thanks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSession

func DeleteSession(arg1 Session) (err error)

DeleteSession is a wrapper for libtorrent::session

Types

type Session

type Session interface {
	WrappedSession
	GetHandle() (SessionHandle, error)
}

Session is a wrapper for libtorrent::session

func NewSession

func NewSession(a ...interface{}) (ret Session, err error)

NewSession is a wrapper for libtorrent::session

type SessionHandle

type SessionHandle interface {
	WrappedSessionHandle
	AddTorrent(...interface{}) (TorrentHandle, error)
	AsyncAddTorrent(AddTorrentParams) error
	RemoveTorrent(...interface{}) error
}

SessionHandle is a wrapper for libtorrent::session_handle

type SessionHandleImpl

type SessionHandleImpl struct {
	WrappedSessionHandle
}

SessionHandleImpl ...

func (SessionHandleImpl) AddTorrent

func (p SessionHandleImpl) AddTorrent(a ...interface{}) (ret TorrentHandle, err error)

AddTorrent is a wrapper for libtorrent::session_handle::add_torrent

func (SessionHandleImpl) AsyncAddTorrent

func (p SessionHandleImpl) AsyncAddTorrent(arg2 AddTorrentParams) (err error)

AsyncAddTorrent is a wrapper for libtorrent::session_handle::async_add_torrent

func (SessionHandleImpl) RemoveTorrent

func (p SessionHandleImpl) RemoveTorrent(a ...interface{}) (err error)

RemoveTorrent is a wrapper for libtorrent::session_handle::remove_torrent

type SessionImpl

type SessionImpl struct {
	WrappedSession
}

SessionImpl ...

func (SessionImpl) GetHandle

func (p SessionImpl) GetHandle() (ret SessionHandle, err error)

GetHandle is a wrapper for libtorrent::session::get_handle

type TorrentHandle

type TorrentHandle interface {
	WrappedTorrentHandle
}

TorrentHandle is a wrapper for libtorrent::torrent_handle

type TorrentHandleImpl

type TorrentHandleImpl struct {
	WrappedTorrentHandle
}

TorrentHandleImpl ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL