transmission

package module
v0.0.0-...-5bdab4b Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: GPL-2.0 Imports: 7 Imported by: 0

README

gtransmission

Multiple transmission protocol implementation in golang.

Currently working on bttorrent protocol.

Documentation

Index

Constants

View Source
const (
	HashSHA1   = "sha1"
	HashSHA256 = "sha256"
)

Hash type

Variables

View Source
var (
	ErrMalformedMagnetLink = errors.New("Malformed magnet link")
	ErrWrongMagnetLinkType = errors.New("Wrong magnet link type")
)

Errors

View Source
var (
	ErrMalformedUrn = errors.New("Malformed urn")
)

Errors

Functions

This section is empty.

Types

type HashValue

type HashValue struct {
	Type  string
	Value []byte
}

HashValue defines the hash value

type MagnetLink struct {
	Dn       []string            // Display name
	Xt       []Urn               // Exact topic
	Xl       []int               // Exact length
	As       []string            // Acceptable source
	Xs       []string            // Exact source
	Kt       []string            // Keyword topic
	Mt       []string            // Manifest topic
	Tr       []string            // Tracker address
	So       []NumRange          // Select only
	Exps     map[string][]string // Experimental parameters (which must begin with "x.")
	Unknowns map[string][]string // Uknown parameters
}

MagnetLink defines magnet link

func ParseMagnetLink(uri string, opts ...MagnetLinkParseOption) (*MagnetLink, error)

ParseMagnetLink parses magnetLink uri

func (*MagnetLink) AsTorrent

func (l *MagnetLink) AsTorrent() (*TorrentMagnetLink, error)

AsTorrent converts to TorrentMagnetLink

type MagnetLinkParseOption

type MagnetLinkParseOption interface {
	// contains filtered or unexported methods
}

MagnetLinkParseOption defines the magnet link parse option

func WithMagnetLinkParseStrictOption

func WithMagnetLinkParseStrictOption(strict bool) MagnetLinkParseOption

WithMagnetLinkParseStrictOption defines the strict option

type NumRange

type NumRange struct {
	Start        int
	End          int
	IncludeStart bool
	IncludeEnd   bool
}

NumRange defines a number range

func NewSingleNumRange

func NewSingleNumRange(num int) NumRange

NewSingleNumRange creates a new NumRange by a single number

func ParseNumRangeFromString

func ParseNumRangeFromString(s string) (r NumRange, err error)

ParseNumRangeFromString parses a number range from string Format:

\d+
\d+\-\d+
type TorrentMagnetLink struct {
	*MagnetLink

	InfoHashs []HashValue
}

TorrentMagnetLink defines torrent magnet link

func ParseTorrentMagnetLink(uri string, opts ...MagnetLinkParseOption) (*TorrentMagnetLink, error)

ParseTorrentMagnetLink parses torrent magnet link

type Urn

type Urn struct {
	Nid string // Namespace identifier
	Nss string // Interpretation of this field depends on the specified namespace
}

Urn defines urn

func ParseUrn

func ParseUrn(urn string) (u Urn, err error)

ParseUrn parses urn

func (Urn) String

func (u Urn) String() string

Jump to

Keyboard shortcuts

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