Documentation ¶
Overview ¶
Package rest implements an IPFS Cluster API component. It provides a REST-ish API to interact with Cluster over HTTP.
Index ¶
Constants ¶
View Source
const ( DefaultListenAddr = "/ip4/127.0.0.1/tcp/9094" DefaultReadTimeout = 30 * time.Second DefaultReadHeaderTimeout = 5 * time.Second DefaultWriteTimeout = 60 * time.Second DefaultIdleTimeout = 120 * time.Second )
These are the default values for Config
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API implements an API and aims to provides a RESTful HTTP API for Cluster.
func NewAPI ¶
NewAPI creates a new REST API component. It receives the multiaddress on which the API listens.
type Config ¶
type Config struct { config.Saver // Listen parameters for the the Cluster HTTP API component. ListenAddr ma.Multiaddr // TLS configuration for the HTTP listener TLS *tls.Config // Maximum duration before timing out reading a full request ReadTimeout time.Duration // Maximum duration before timing out reading the headers of a request ReadHeaderTimeout time.Duration // Maximum duration before timing out write of the response WriteTimeout time.Duration // Server-side amount of time a Keep-Alive connection will be // kept idle before being reused IdleTimeout time.Duration // BasicAuthCreds is a map of username-password pairs // which are authorized to use Basic Authentication BasicAuthCreds map[string]string // contains filtered or unexported fields }
Config is used to intialize the API object and allows to customize the behaviour of it. It implements the config.ComponentConfig interface.
func (*Config) LoadJSON ¶
LoadJSON parses a raw JSON byte slice created by ToJSON() and sets the configuration fields accordingly.
Click to show internal directories.
Click to hide internal directories.