confluence

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MPL-2.0 Imports: 38 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultTorrentClient

func NewDefaultTorrentClient() (ret *torrent.Client, err error)

func ServeFile added in v1.3.0

func ServeFile(w http.ResponseWriter, r *http.Request, t *torrent.Torrent, _path string)

func ServeTorrent added in v1.3.0

func ServeTorrent(w http.ResponseWriter, r *http.Request, t *torrent.Torrent)

func ServeTorrentReader added in v1.3.0

func ServeTorrentReader(w http.ResponseWriter, r *http.Request, tr torrent.Reader, name string)

Types

type Event

type Event struct {
	PieceChanged *int
}

type Handler

type Handler struct {
	Logger         *log.Logger
	TC             *torrent.Client
	TorrentGrace   time.Duration
	OnTorrentGrace func(t *torrent.Torrent)

	// If non-nil, this is the directory to cache metainfos in.
	MetainfoCacheDir *string
	// A squirrel Cache to storage the metainfos. Supercedes the MetainfoCacheDir.
	MetainfoStorage *squirrel.Cache
	// Bring your own metainfo storage. Supercedes all alternatives.
	MetainfoStorageInterface MetainfoStorage

	// Called as soon as a new torrent is added, with the cached metainfo if it's found.
	OnNewTorrent func(newTorrent *torrent.Torrent, cachedMetainfo *metainfo.MetaInfo)
	DhtServers   []*dht.Server
	Storage      *storage.Client
	// Alter metainfos returned from upload handler. For example to add trackers, nodes, comments etc.
	ModifyUploadMetainfo func(mi *metainfo.MetaInfo)
	// contains filtered or unexported fields
}

func (*Handler) GetTorrent added in v1.3.0

func (h *Handler) GetTorrent(ih metainfo.Hash) (t *torrent.Torrent, new bool, release func())

func (*Handler) PutMetainfo added in v1.3.0

func (h *Handler) PutMetainfo(t *torrent.Torrent, mi *metainfo.MetaInfo) error

We require the Torrent to be given to ensure we don't infer a torrent from the MetaInfo without any release semantics. A torrent is needed to merge in the spec from the metainfo, and then to save the merged metainfo.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MetainfoStorage added in v1.15.0

type MetainfoStorage interface {
	Put(ih infohash.T, data []byte) error
	Get(ih infohash.T) (io.ReadCloser, error)
}

type ResourceProviderMetainfoStorage added in v1.15.0

type ResourceProviderMetainfoStorage struct {
	Provider resource.Provider
	Dir      string
}

func (ResourceProviderMetainfoStorage) Get added in v1.15.0

func (ResourceProviderMetainfoStorage) Put added in v1.15.0

func (m ResourceProviderMetainfoStorage) Put(ih infohash.T, data []byte) (err error)

Jump to

Keyboard shortcuts

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