We should deprecate passing in Host/Port in the config,
but in the meantime, it hardcoded /dns4/, meaning that if
someone placed an ipv6 address in there things would break badly
and weirdly.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
Before we resolved all /dns*/ multiaddresses before we used them.
When using HTTPs, the Go HTTP Client only sees the resolved IP address
and it is unable to negotiate TLS with a cerficate because the request
is not going to the hostname the certificate is signed for, but to
the IP. This leverages a recent feature in go-multiaddr-net
and uses directly the user-provided hostname.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
Issue #572 exposes metrics but they carry the peer ID in binary.
This was ok with our internal codecs but it doesn't seem to work
very well with json, and makes the output format unusable.
This makes the Metric.Peer field a string.
Additinoally, fixes calling the command without arguments and displaying
the date in the right format.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
Support the new endpoint for later metrics in `rest/api/client`
Support the new method created in `rest/api/client` in
ipfs-cluster-ctl. i.e. `ipfs-cluster-ctl health metrics <name>` would
show the peers and the last list of metrics logged for each as returned
by the Peer Monitor, in a friendly way.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Opened new endpoint `GET /health/metrics/<name>` which would respond
with metrics of type <name>
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
By default, CORS headers allowing GET requests from everywhere are
set. This should facilitate the IPFS Web UI integration with the
Cluster API.
This commit refactors the sendResponse methods in the API, merging
them into one as it was difficult to follow the flows that actually
send something to the client. All tests now check the presence of
the configured headers too, to make sure no route was missed.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This straigthens some mistakes with the outputs of the /add endpoints.
Currently, we had exactly the same output format which:
* was not exactly the ipfs API output format but was sort of similar
* made some weird concessions to be compatible (like having a string-type "size")
* was not aligned with Cluster API conventions (lowercase keys)
This corrects all this:
* The Cluster API /add output format now uses the right types and lowercase keys.
* `Hash` is now `Cid`, because the field carries a Cid.
* We copy error handling with request trailers from IPFS, and avoid carrying the
errors in the output objects.
* The proxy now returns exactly the types as ipfs would
* We add the X-Chunked-Output: 1 header, which is custom and redundant, but
otherwise breaks js-ipfs-api integrations with the /add endpoint.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This is a workaround to have clients behave properly with the /add
endpoint by asking them to close connections when done, effectively
disabling keep-alive for this.
This means we don't need to disable keep-alives fully on all servers,
since the rest of endpoints are not affected (they are not streaming
endpoints).
Reference https://github.com/ipfs/go-ipfs/issues/5168
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
.Add(paths) will interpret http* paths as WebFiles. These are read performing
a GET request to the location. Otherwise, the path is interpreted as a local
disk file/folder, and read from disk. ipfs-cluster-ctl has been updated
accordingly.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
See discussion in https://github.com/ipfs/go-ipfs/issues/5168
We cannot stream responses with keep-alives enabled.
I prefer this to not be a client feature, as otherwise users might end up
shooting themselves in the foot.
Note, the price is a corrupted request body which gets added
normally and gives wrong hashes!
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This removes PeerAddr and uses APIAddr directly, figuring out if it is
a Peer multiaddress or not.
PeerAddr is actually kept for compatiblity.
It also fixes a bad panic when resolving returned 0 results
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This removes a bunch of the channel dance and block forwarding
by having the adder submodules be DAGServices themselves and take
Add() directly from the ipfsAdder.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>