Skip to content

Commit

Permalink
Merge pull request ipfs/kubo#8958 from ipfs/chore/rename-to-kubo
Browse files Browse the repository at this point in the history
refactor: rename to kubo

see: ipfs/kubo#8959 

This commit was moved from ipfs/kubo@d82dec3
  • Loading branch information
lidel authored Jul 6, 2022
2 parents 2871589 + 727a167 commit 1826a07
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions gateway/core/corehttp/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"strconv"
"strings"

version "github.com/ipfs/go-ipfs"
oldcmds "github.com/ipfs/go-ipfs/commands"
"github.com/ipfs/go-ipfs/core"
corecommands "github.com/ipfs/go-ipfs/core/commands"
version "github.com/ipfs/kubo"
oldcmds "github.com/ipfs/kubo/commands"
"github.com/ipfs/kubo/core"
corecommands "github.com/ipfs/kubo/core/commands"

cmds "github.com/ipfs/go-ipfs-cmds"
cmdsHttp "github.com/ipfs/go-ipfs-cmds/http"
config "github.com/ipfs/go-ipfs/config"
path "github.com/ipfs/go-path"
config "github.com/ipfs/kubo/config"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/corehttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"net/http"
"time"

core "github.com/ipfs/go-ipfs/core"
logging "github.com/ipfs/go-log"
core "github.com/ipfs/kubo/core"
"github.com/jbenet/goprocess"
periodicproc "github.com/jbenet/goprocess/periodic"
ma "github.com/multiformats/go-multiaddr"
Expand Down
6 changes: 3 additions & 3 deletions gateway/core/corehttp/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"
"sort"

version "github.com/ipfs/go-ipfs"
core "github.com/ipfs/go-ipfs/core"
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
version "github.com/ipfs/kubo"
core "github.com/ipfs/kubo/core"
coreapi "github.com/ipfs/kubo/core/coreapi"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"

options "github.com/ipfs/interface-go-ipfs-core/options"
Expand Down
16 changes: 8 additions & 8 deletions gateway/core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func newGatewaySummaryMetric(name string, help string) *prometheus.SummaryVec {

func newGatewayHistogramMetric(name string, help string) *prometheus.HistogramVec {
// We can add buckets as a parameter in the future, but for now using static defaults
// suggested in https://github.com/ipfs/go-ipfs/issues/8441
// suggested in https://github.com/ipfs/kubo/issues/8441
defaultBuckets := []float64{0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60}
histogramMetric := prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Expand Down Expand Up @@ -666,11 +666,11 @@ func addCacheControlHeaders(w http.ResponseWriter, r *http.Request, contentPath
// mutable namespaces such as /ipns/ can't be cached forever

/* For now we set Last-Modified to Now() to leverage caching heuristics built into modern browsers:
* https://github.com/ipfs/go-ipfs/pull/8074#pullrequestreview-645196768
* https://github.com/ipfs/kubo/pull/8074#pullrequestreview-645196768
* but we should not set it to fake values and use Cache-Control based on TTL instead */
modtime = time.Now()

// TODO: set Cache-Control based on TTL of IPNS/DNSLink: https://github.com/ipfs/go-ipfs/issues/1818#issuecomment-1015849462
// TODO: set Cache-Control based on TTL of IPNS/DNSLink: https://github.com/ipfs/kubo/issues/1818#issuecomment-1015849462
// TODO: set Last-Modified based on /ipns/ publishing timestamp?
} else {
// immutable! CACHE ALL THE THINGS, FOREVER! wolololol
Expand All @@ -679,7 +679,7 @@ func addCacheControlHeaders(w http.ResponseWriter, r *http.Request, contentPath
// Set modtime to 'zero time' to disable Last-Modified header (superseded by Cache-Control)
modtime = noModtime

// TODO: set Last-Modified? - TBD - /ipfs/ modification metadata is present in unixfs 1.5 https://github.com/ipfs/go-ipfs/issues/6920?
// TODO: set Last-Modified? - TBD - /ipfs/ modification metadata is present in unixfs 1.5 https://github.com/ipfs/kubo/issues/6920?
}

return modtime
Expand Down Expand Up @@ -874,7 +874,7 @@ func getEtag(r *http.Request, cid cid.Cid) string {
// Etag: "cid.foo" (gives us nice compression together with Content-Disposition in block (raw) and car responses)
suffix = `.` + f + suffix
}
// TODO: include selector suffix when https://github.com/ipfs/go-ipfs/issues/8769 lands
// TODO: include selector suffix when https://github.com/ipfs/kubo/issues/8769 lands
return prefix + cid.String() + suffix
}

Expand Down Expand Up @@ -957,10 +957,10 @@ func debugStr(path string) string {
}

func handleUnsupportedHeaders(r *http.Request) (err *requestError) {
// X-Ipfs-Gateway-Prefix was removed (https://github.com/ipfs/go-ipfs/issues/7702)
// X-Ipfs-Gateway-Prefix was removed (https://github.com/ipfs/kubo/issues/7702)
// TODO: remove this after go-ipfs 0.13 ships
if prfx := r.Header.Get("X-Ipfs-Gateway-Prefix"); prfx != "" {
err := fmt.Errorf("X-Ipfs-Gateway-Prefix support was removed: https://github.com/ipfs/go-ipfs/issues/7702")
err := fmt.Errorf("X-Ipfs-Gateway-Prefix support was removed: https://github.com/ipfs/kubo/issues/7702")
return newRequestError("unsupported HTTP header", err, http.StatusBadRequest)
}
return nil
Expand Down Expand Up @@ -996,7 +996,7 @@ func handleProtocolHandlerRedirect(w http.ResponseWriter, r *http.Request, logge
}

// Disallow Service Worker registration on namespace roots
// https://github.com/ipfs/go-ipfs/issues/4025
// https://github.com/ipfs/kubo/issues/4025
func handleServiceWorkerRegistration(r *http.Request) (err *requestError) {
if r.Header.Get("Service-Worker") == "script" {
matched, _ := regexp.MatchString(`^/ip[fn]s/[^/]+$`, r.URL.Path)
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/gateway_handler_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http"
"time"

"github.com/ipfs/go-ipfs/tracing"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/kubo/tracing"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
Expand Down
4 changes: 2 additions & 2 deletions gateway/core/corehttp/gateway_handler_car.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-ipfs/tracing"
coreiface "github.com/ipfs/interface-go-ipfs-core"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/kubo/tracing"
gocar "github.com/ipld/go-car"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"go.opentelemetry.io/otel/attribute"
Expand Down Expand Up @@ -71,7 +71,7 @@ func (i *gatewayHandler) serveCAR(ctx context.Context, w http.ResponseWriter, r
// Same go-car settings as dag.export command
store := dagStore{dag: i.api.Dag(), ctx: ctx}

// TODO: support selectors passed as request param: https://github.com/ipfs/go-ipfs/issues/8769
// TODO: support selectors passed as request param: https://github.com/ipfs/kubo/issues/8769
dag := gocar.Dag{Root: rootCid, Selector: selectorparse.CommonSelector_ExploreAllRecursively}
car := gocar.NewSelectiveCar(ctx, store, []gocar.Dag{dag}, gocar.TraverseLinksOnlyOnce())

Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/gateway_handler_unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

files "github.com/ipfs/go-ipfs-files"
"github.com/ipfs/go-ipfs/tracing"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/kubo/tracing"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"
Expand Down
8 changes: 4 additions & 4 deletions gateway/core/corehttp/gateway_handler_unixfs_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"github.com/dustin/go-humanize"
cid "github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
"github.com/ipfs/go-ipfs/assets"
"github.com/ipfs/go-ipfs/tracing"
path "github.com/ipfs/go-path"
"github.com/ipfs/go-path/resolver"
options "github.com/ipfs/interface-go-ipfs-core/options"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/kubo/assets"
"github.com/ipfs/kubo/tracing"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"
Expand Down Expand Up @@ -81,7 +81,7 @@ func (i *gatewayHandler) serveDirectory(ctx context.Context, w http.ResponseWrit
}

// See statusResponseWriter.WriteHeader
// and https://github.com/ipfs/go-ipfs/issues/7164
// and https://github.com/ipfs/kubo/issues/7164
// Note: this needs to occur before listingTemplate.Execute otherwise we get
// superfluous response.WriteHeader call from prometheus/client_golang
if w.Header().Get("Location") != "" {
Expand Down Expand Up @@ -146,7 +146,7 @@ func (i *gatewayHandler) serveDirectory(ctx context.Context, w http.ResponseWrit
}

// construct the correct back link
// https://github.com/ipfs/go-ipfs/issues/1365
// https://github.com/ipfs/kubo/issues/1365
var backLink string = originalUrlPath

// don't go further up than /ipfs/$hash/
Expand Down
6 changes: 3 additions & 3 deletions gateway/core/corehttp/gateway_handler_unixfs_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/gabriel-vasile/mimetype"
files "github.com/ipfs/go-ipfs-files"
"github.com/ipfs/go-ipfs/tracing"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/kubo/tracing"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func (i *gatewayHandler) serveFile(ctx context.Context, w http.ResponseWriter, r
ctype = mime.TypeByExtension(gopath.Ext(name))
if ctype == "" {
// uses https://github.com/gabriel-vasile/mimetype library to determine the content type.
// Fixes https://github.com/ipfs/go-ipfs/issues/7252
// Fixes https://github.com/ipfs/kubo/issues/7252
mimeType, err := mimetype.DetectReader(content)
if err != nil {
http.Error(w, fmt.Sprintf("cannot detect content-type: %s", err.Error()), http.StatusInternalServerError)
Expand All @@ -71,7 +71,7 @@ func (i *gatewayHandler) serveFile(ctx context.Context, w http.ResponseWriter, r
// Strip the encoding from the HTML Content-Type header and let the
// browser figure it out.
//
// Fixes https://github.com/ipfs/go-ipfs/issues/2203
// Fixes https://github.com/ipfs/kubo/issues/2203
if strings.HasPrefix(ctype, "text/html;") {
ctype = "text/html"
}
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/gateway_indexPage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path"
"strings"

"github.com/ipfs/go-ipfs/assets"
ipfspath "github.com/ipfs/go-path"
"github.com/ipfs/kubo/assets"
)

// structs for directory listing
Expand Down
10 changes: 5 additions & 5 deletions gateway/core/corehttp/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import (
"testing"
"time"

version "github.com/ipfs/go-ipfs"
core "github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/coreapi"
repo "github.com/ipfs/go-ipfs/repo"
namesys "github.com/ipfs/go-namesys"
version "github.com/ipfs/kubo"
core "github.com/ipfs/kubo/core"
"github.com/ipfs/kubo/core/coreapi"
repo "github.com/ipfs/kubo/repo"

datastore "github.com/ipfs/go-datastore"
syncds "github.com/ipfs/go-datastore/sync"
files "github.com/ipfs/go-ipfs-files"
config "github.com/ipfs/go-ipfs/config"
path "github.com/ipfs/go-path"
iface "github.com/ipfs/interface-go-ipfs-core"
nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
ipath "github.com/ipfs/interface-go-ipfs-core/path"
config "github.com/ipfs/kubo/config"
ci "github.com/libp2p/go-libp2p-core/crypto"
id "github.com/libp2p/go-libp2p/p2p/protocol/identify"
)
Expand Down
12 changes: 6 additions & 6 deletions gateway/core/corehttp/hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import (
"strings"

cid "github.com/ipfs/go-cid"
core "github.com/ipfs/go-ipfs/core"
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
namesys "github.com/ipfs/go-namesys"
core "github.com/ipfs/kubo/core"
coreapi "github.com/ipfs/kubo/core/coreapi"
"github.com/libp2p/go-libp2p-core/peer"
dns "github.com/miekg/dns"

mbase "github.com/multiformats/go-multibase"

config "github.com/ipfs/go-ipfs/config"
iface "github.com/ipfs/interface-go-ipfs-core"
options "github.com/ipfs/interface-go-ipfs-core/options"
nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
config "github.com/ipfs/kubo/config"
)

var defaultPaths = []string{"/ipfs/", "/ipns/", "/api/", "/p2p/"}
Expand Down Expand Up @@ -506,13 +506,13 @@ func toSubdomainURL(hostname, path string, r *http.Request, ipfs iface.CoreAPI)
// Normalizations specific to /ipns/{libp2p-key}
if isPeerIDNamespace(ns) {
// Using Base36 for /ipns/ for consistency
// Context: https://github.com/ipfs/go-ipfs/pull/7441#discussion_r452372828
// Context: https://github.com/ipfs/kubo/pull/7441#discussion_r452372828
base = mbase.Base36

// PeerIDs represented as CIDv1 are expected to have libp2p-key
// multicodec (https://github.com/libp2p/specs/pull/209).
// We ease the transition by fixing multicodec on the fly:
// https://github.com/ipfs/go-ipfs/issues/5287#issuecomment-492163929
// https://github.com/ipfs/kubo/issues/5287#issuecomment-492163929
if multicodec != cid.Libp2pKey {
multicodec = cid.Libp2pKey
}
Expand All @@ -531,7 +531,7 @@ func toSubdomainURL(hostname, path string, r *http.Request, ipfs iface.CoreAPI)
return "", err
}
// 2. Make sure CID fits in a DNS label, adjust encoding if needed
// (https://github.com/ipfs/go-ipfs/issues/7318)
// (https://github.com/ipfs/kubo/issues/7318)
rootID, err = toDNSLabel(rootID, rootCID)
if err != nil {
return "", err
Expand Down
4 changes: 2 additions & 2 deletions gateway/core/corehttp/hostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

cid "github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
config "github.com/ipfs/go-ipfs/config"
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
path "github.com/ipfs/go-path"
config "github.com/ipfs/kubo/config"
coreapi "github.com/ipfs/kubo/core/coreapi"
)

func TestToSubdomainURL(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net"
"net/http"

core "github.com/ipfs/go-ipfs/core"
lwriter "github.com/ipfs/go-log/writer"
core "github.com/ipfs/kubo/core"
)

type writeErrNotifier struct {
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"time"

core "github.com/ipfs/go-ipfs/core"
core "github.com/ipfs/kubo/core"
"go.opencensus.io/stats/view"
"go.opencensus.io/zpages"

Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/kubo/core"

inet "github.com/libp2p/go-libp2p-core/network"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/mutex_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"runtime"
"strconv"

core "github.com/ipfs/go-ipfs/core"
core "github.com/ipfs/kubo/core"
)

// MutexFractionOption allows to set runtime.SetMutexProfileFraction via HTTP
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

version "github.com/ipfs/go-ipfs"
version "github.com/ipfs/kubo"
)

type testcasecheckversion struct {
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/p2p_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"
"strings"

core "github.com/ipfs/go-ipfs/core"
core "github.com/ipfs/kubo/core"
peer "github.com/libp2p/go-libp2p-core/peer"

protocol "github.com/libp2p/go-libp2p-core/protocol"
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/p2p_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/ipfs/go-ipfs/thirdparty/assert"
"github.com/ipfs/kubo/thirdparty/assert"

protocol "github.com/libp2p/go-libp2p-core/protocol"
)
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net"
"net/http"

core "github.com/ipfs/go-ipfs/core"
core "github.com/ipfs/kubo/core"
)

func RedirectOption(path string, redirect string) ServeOption {
Expand Down

0 comments on commit 1826a07

Please sign in to comment.