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 ¶
const OpenToken = "open"
OpenToken is the key of a server in open mode (see SetOpen). It is no secret: the pages carry it so that they send the Authorization header every request needs, which a page of another site cannot do without a preflight request that this server never allows.
Variables ¶
This section is empty.
Functions ¶
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 Place ¶ added in v1.1.0
Place is a folder the server is given by the system around it, under the name that system shows it by (see Server.SetPlaces).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP handler.
func (*Server) SetFixedPort ¶ added in v1.1.0
SetFixedPort says the torrent port was given at start and is not the page's to change: a container publishes just that port, and a different one would get no incoming connections at all (found on Umbrel, where the button for a random port moved the program off the published one).
func (*Server) SetOpen ¶ added in v1.0.24
SetOpen puts the server in open mode, for running behind a proxy that signs the user in (Umbrel's app proxy does): nobody has to carry a personal key, every page gets OpenToken, and the host names of the requests need not be loopback ones. Because DNS rebinding needs a name, a request is still refused unless it comes by an IP address, a short or local name (see hostAllowed) or one of extraHosts.
func (*Server) SetPlaces ¶ added in v1.1.0
SetPlaces gives the folders the server may use, by the names the system around it shows them under (Umbrel's Files: "Downloads" is /downloads in the container). The page then shows paths by those names, and the folder picker offers just these folders and does not go above them.
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.