api

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api exposes the core over HTTP/JSON. Every request needs the API token, so a web page opened in the user's browser cannot drive the client through localhost.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadToken

func LoadToken(path string) (string, error)

LoadToken returns the persistent API token stored at path, creating it if needed.

Types

type About added in v1.0.1

type About struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	GoVer   string `json:"goVersion"`
	OS      string `json:"os"`     // "windows/amd64"
	Engine  string `json:"engine"` // e.g. "github.com/anacrolix/torrent v1.61.0", "" if unknown
}

About is the static "About" info of the running build, for the settings page.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP handler.

func New

func New(m *core.Manager, cfg *config.Store, token string, ui http.Handler) *Server

New builds the handler. ui serves the web interface for non-API paths (may be nil).

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type UpdateStatus added in v1.0.6

type UpdateStatus struct {
	Available bool   `json:"available"`
	Version   string `json:"version,omitempty"`
	Notes     string `json:"notes,omitempty"`
	URL       string `json:"url,omitempty"` // the release's page, for a manual download
}

UpdateStatus is what the settings page shows about a newer release.

Jump to

Keyboard shortcuts

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