862c1eb3ea
This commit makes the proxy extract useful fixed headers (like CORS) from the IPFS daemon API responses and then apply them to the responses from hijacked endpoints like /add or /repo/stat. It does this by caching a list of headers from the first IPFS API response which has them. If we have not performed any proxied request or managed to obtain the headers we're interested in, this will try triggering a request to "/api/v0/version" to obtain them first. This should fix the issues with using Cluster proxy with IPFS Companion and Chrome. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
18 lines
466 B
Go
18 lines
466 B
Go
package version
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
semver "github.com/blang/semver"
|
|
protocol "github.com/libp2p/go-libp2p-protocol"
|
|
)
|
|
|
|
// Version is the current cluster version. Version alignment between
|
|
// components, apis and tools ensures compatibility among them.
|
|
var Version = semver.MustParse("0.7.0")
|
|
|
|
// RPCProtocol is used to send libp2p messages between cluster peers
|
|
var RPCProtocol = protocol.ID(
|
|
fmt.Sprintf("/ipfscluster/%d.%d/rpc", Version.Major, Version.Minor),
|
|
)
|