The new coreiface.Path maps a path to the cid.Cid
resulting from a full path resolution.
The path is internally represented as a go-ipfs/path.Path,
but that doesn't matter to the outside.
Apart from the path-to-CID mapping, it also aims to hold all
resolved segment CIDs of the path. Right now it only exposes
Root(), and only for flat paths a la /ipfs/Qmfoo. In other cases,
the root is nil.
In the future, resolution will internally use
go-ipfs/path.Resolver.ResolvePathComponents and thus always return
the proper resolved segments, via Root(), or a future Segments() func.
- Add coreiface.Path with Cid() and Root().
- Add CoreAPI.ResolvePath() for getting a coreiface.Path.
- All functions now expect and return coreiface.Path.
- Add ParsePath() and ParseCid() for constructing a coreiface.Path.
- Add coreiface.Node and Link which are simply go-ipld-node.Node and Link.
- Add CoreAPI.ResolveNode() for getting a Node from a Path.
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
The Suborigins spec was changed and we have to adjust, the spec is still
unstable and it might change in future. Currently the only browser
supporting it (Chrome) errors out on it as it doesn't confront spec it
uses.
See https://github.com/ipfs/specs/issues/131
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Also change existing 'Node' type to 'ProtoNode' and use that most
everywhere for now. As we move forward with the integration we will try
and use the Node interface in more places that we're currently using
ProtoNode.
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This change adds the /ipfs/bitswap/1.1.0 protocol. The new protocol
adds a 'payload' field to the protobuf message and deprecates the
existing 'blocks' field. The 'payload' field is an array of pairs of cid
prefixes and block data. The cid prefixes are used to ensure the correct
codecs and hash functions are used to handle the block on the receiving
end.
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This patch is in preparation for the gateway's extraction.
It's interesting to trace technical debt back to its
origin, understanding the circumstances in which it
was introduced and built up, and then cutting it back
at exactly the right places.
- Clean up the gateway's surface
The option builder GatewayOption() now takes only
arguments which are relevant for HTTP handler muxing,
i.e. the paths where the gateway should be mounted.
All other configuration happens through the
GatewayConfig object.
- Remove BlockList
I know why this was introduced in the first place,
but it never ended up fulfilling that purpose.
Somehow it was only ever used by the API server,
not the gateway, which really doesn't make sense.
It was also never wired up with CLI nor fs-repo.
Eventually @krl started punching holes into it
to make the Web UI accessible.
- Remove --unrestricted-api
This was holes being punched into BlockList too,
for accessing /ipfs and /ipn on the API server.
With BlockList removed and /ipfs and /ipns freely
accessible, putting this option out of action
is safe. With the next major release,
the option can be removed for good.
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
The gateway accepts an X-Ipfs-Path-Prefix header,
and assumes that it is mounted in a reverse proxy
like nginx, at this path. Links in directory listings,
as well as trailing-slash redirects need to be rewritten
with that prefix in mind.
We don't want a potential attacker to be able to
pass in arbitrary path prefixes, which would end up
in redirects and directory listings, which is why
every prefix has to be explicitly allowed in the config.
Previously, we'd accept *any* X-Ipfs-Path-Prefix header.
Example:
We mount blog.ipfs.io (a dnslink page) at ipfs.io/blog.
nginx_ipfs.conf:
location /blog/ {
rewrite "^/blog(/.*)$" $1 break;
proxy_set_header Host blog.ipfs.io;
proxy_set_header X-Ipfs-Gateway-Prefix /blog;
proxy_pass http://127.0.0.1:8080;
}
.ipfs/config:
"Gateway": {
"PathPrefixes": ["/blog"],
// ...
},
dnslink:
> dig TXT _dnslink.blog.ipfs.io
dnslink=/ipfs/QmWcBjXPAEdhXDATV4ghUpkAonNBbiyFx1VmmHcQe9HEGd
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
panic: net/http: CloseNotify called after ServeHTTP finished
goroutine 180 [running]:
net/http.(*response).CloseNotify(0xc8220684e0, 0x0)
/home/r/go/src/net/http/server.go:1535 +0x9d
github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prometheus/client_golang/
/home/r/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prome
github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandler.func1(0x7
/home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:119 +
created by github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandle
/home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:123 +
License: MIT
Signed-off-by: Robert Carlsen <rwcarlsen@gmail.com>
OPTIONS is a noop request that is used by the browsers
to check if server will accept cross-site XMLHttpRequest
(indicated by the presence of CORS headers)
Before this fix user could enable CORS headers in the Gateway config,
but XHR failed due to the lack of support for OPTIONS request type
(as described in https://git.io/vzgGe)
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
dont GC blocks used by pinner
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
comment GC algo
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
add lock to blockstore to prevent GC from eating wanted blocks
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
improve FetchGraph
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
separate interfaces for blockstore and GCBlockstore
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
reintroduce indirect pinning, add enumerateChildren dag method
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
Pinner had method GetManual that returned a ManualPinner, so every
Pinner had to implement ManualPinner anyway.
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>