Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultListenAddr = "/ip4/127.0.0.1/tcp/9095" DefaultNodeAddr = "/ip4/127.0.0.1/tcp/5001" DefaultNodeHTTPS = false DefaultReadTimeout = 0 DefaultReadHeaderTimeout = 5 * time.Second DefaultWriteTimeout = 0 DefaultIdleTimeout = 60 * time.Second DefaultExtractHeadersPath = "/api/v0/version" DefaultExtractHeadersTTL = 5 * time.Minute )
Default values for Config.
Variables ¶
View Source
var DNSTimeout = 5 * time.Second
DNSTimeout is used when resolving DNS multiaddresses in this module
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { config.Saver // Listen parameters for the IPFS Proxy. ListenAddr ma.Multiaddr // Host/Port for the IPFS daemon. NodeAddr ma.Multiaddr // Should we talk to the IPFS API over HTTPS? (experimental, untested) NodeHTTPS bool // 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 // A list of custom headers that should be extracted from // IPFS daemon responses and re-used in responses from hijacked paths. // This is only useful if the user has configured custom headers // in the IPFS daemon. CORS-related headers are already // taken care of by the proxy. ExtractHeadersExtra []string // If the user wants to extract some extra custom headers configured // on the IPFS daemon so that they are used in hijacked responses, // this request path will be used. Defaults to /version. This will // trigger a single request to extract those headers and remember them // for future requests (until TTL expires). ExtractHeadersPath string // Establishes how long we should remember extracted headers before we // refresh them with a new request. 0 means always. ExtractHeadersTTL time.Duration }
Config allows to customize behaviour of IPFSProxy. It implements the config.ComponentConfig interface.
func (*Config) LoadJSON ¶
LoadJSON parses a JSON representation of this Config as generated by ToJSON.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server offers an IPFS API, hijacking some interesting requests and forwarding the rest to the ipfs daemon it proxies HTTP requests to the configured IPFS daemon. It is able to intercept these requests though, and perform extra operations on them.
Click to show internal directories.
Click to hide internal directories.