-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPFS Gateway #198
IPFS Gateway #198
Conversation
Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
@@ -0,0 +1,271 @@ | |||
package gateway |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the gateway bucket stuff was moved here.
@@ -0,0 +1,211 @@ | |||
package gateway |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the IPFS related gateway stuff is here.
// if object turns out to be a valid CID, | ||
// ensure text representation used in subdomain is CIDv1 in Base32 | ||
// https://github.com/ipfs/in-web-browsers/issues/89 | ||
rootID, err = cid.NewCidV1(multicodec, rootCid.Hash()).StringOfBase(mbase.Base32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old style cids are case-sensitive. So, they get converted to base32.
// We ease the transition by fixing multicodec on the fly: | ||
// https://github.com/ipfs/go-ipfs/issues/5287#issuecomment-492163929 | ||
if isPeerIDNamespace(ns) && multicodec != cid.Libp2pKey { | ||
multicodec = cid.Libp2pKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have these key type cids. Everything is a cid now.
@@ -1,6 +1,6 @@ | |||
{{template "header" "Bucket"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This template is now used for normal IPFS dirs and bucket dirs.
@@ -0,0 +1,82 @@ | |||
package gateway |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing new here, just moving this thread gateway stuff to its own file.
m.ctxsLock.Lock() | ||
m.ctxs[keyID] = cancel | ||
m.ctxsLock.Unlock() | ||
if err := m.publishUnsafe(pctx, pth, keyID); err != nil { | ||
if !errors.Is(err, context.Canceled) { | ||
// Logging as a warning because this often fails with "context deadline exceeded", | ||
// even if the entry can be found on the network (not fully saturated). | ||
// The publish deadline seems to be fixed at one minute. ¯\_(ツ)_/¯ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They fixed it: ipfs/kubo#7256. Now we can use a longer timeout since these are just spinning on their own anyway.
Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes #145
/ipfs
,/ipns
,/p2p
,/ipld
namespaces in the gatewaygo-ipfs
go-ipfs
tov0.5.1
, which includes a fix for the hard-coded max timeout when publishing