Skip to content

Commit

Permalink
Merge branch 'master' into docs-release-0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh authored Oct 12, 2022
2 parents 2321be0 + 4291d6b commit cf4bf8a
Show file tree
Hide file tree
Showing 103 changed files with 3,726 additions and 949 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- stylecheck
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Kubo Changelogs

- [v0.16](docs/changelogs/v0.16.md)
- [v0.15](docs/changelogs/v0.15.md)
- [v0.14](docs/changelogs/v0.14.md)
- [v0.13](docs/changelogs/v0.13.md)
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# kubo

> the oldest IPFS implementation, previously known as "go-ipfs"

![kubo, an IPFS node in Go](https://ipfs.io/ipfs/bafykbzacecaesuqmivkauix25v6i6xxxsvsrtxknhgb5zak3xxsg2nb4dhs2u/ipfs.go.png)

Expand All @@ -10,15 +7,18 @@

## What is Kubo?

Kubo (go-ipfs) the earliest and most widely used implementation of IPFS.
Kubo was the first IPFS implementation and is the most widely used one today. Implementing the *Interplanetary Filesystem* - the Web3 standard and contender to replace https. Thus powered by IPLD's data models and the libp2p for network communication. Kubo is written in Go.

Featureset
- Runs an IPFS-Node as a network service
- [Command Line Interface](https://docs.ipfs.tech/reference/kubo/cli/) to IPFS-Nodes
- Local [Web2-to-Web3 HTTP Gateway functionality](https://github.com/ipfs/specs/tree/main/http-gateways#readme)
- HTTP RPC API (`/api/v0`) to access and control the daemon
- IPFS's internal Webgui can be used to manage the Kubo nodes

It includes:
- an IPFS daemon server
- extensive [command line tooling](https://docs.ipfs.tech/reference/kubo/cli/)
- an [HTTP Gateway](https://docs.ipfs.tech/reference/http/gateway/) (`/ipfs/`, `/ipns/`) for serving content to HTTP browsers
- an [HTTP RPC API](https://docs.ipfs.tech/reference/kubo/rpc/) (`/api/v0`) for controlling the daemon node
### Other implementations

Note: [other implementations exist](https://docs.ipfs.tech/basics/ipfs-implementations/).
See [List](https://docs.ipfs.tech/basics/ipfs-implementations/)

## What is IPFS?

Expand Down
6 changes: 3 additions & 3 deletions cmd/ipfs/add_migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func addMigrations(ctx context.Context, node *core.IpfsNode, fetcher migrations.
}
}
default:
return errors.New("Cannot get migrations from unknown fetcher type")
return errors.New("cannot get migrations from unknown fetcher type")
}
}

Expand Down Expand Up @@ -118,9 +118,9 @@ func addMigrationPaths(ctx context.Context, node *core.IpfsNode, peerInfo peer.A
fmt.Printf("connected to migration peer %q\n", peerInfo)

if pin {
pinApi := ipfs.Pin()
pinAPI := ipfs.Pin()
for _, ipfsPath := range paths {
err := pinApi.Add(ctx, ipfsPath)
err := pinAPI.Add(ctx, ipfsPath)
if err != nil {
return err
}
Expand Down
21 changes: 17 additions & 4 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const (
routingOptionDHTKwd = "dht"
routingOptionDHTServerKwd = "dhtserver"
routingOptionNoneKwd = "none"
routingOptionCustomKwd = "custom"
routingOptionDefaultKwd = "default"
unencryptTransportKwd = "disable-transport-encryption"
unrestrictedApiAccessKwd = "unrestricted-api"
unrestrictedAPIAccessKwd = "unrestricted-api"
writableKwd = "writable"
enablePubSubKwd = "enable-pubsub-experiment"
enableIPNSPubSubKwd = "enable-namesys-pubsub"
Expand Down Expand Up @@ -173,7 +174,7 @@ Headers.
cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
cmds.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
cmds.BoolOption(unrestrictedAPIAccessKwd, "Allow API access to unlisted hashes"),
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").WithDefault(true),
Expand Down Expand Up @@ -401,7 +402,10 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment

routingOption, _ := req.Options[routingOptionKwd].(string)
if routingOption == routingOptionDefaultKwd {
routingOption = cfg.Routing.Type.WithDefault(routingOptionDHTKwd)
routingOption = cfg.Routing.Type
if routingOption == "" {
routingOption = routingOptionDHTKwd
}
}
switch routingOption {
case routingOptionSupernodeKwd:
Expand All @@ -414,6 +418,14 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
ncfg.Routing = libp2p.DHTServerOption
case routingOptionNoneKwd:
ncfg.Routing = libp2p.NilRouterOption
case routingOptionCustomKwd:
ncfg.Routing = libp2p.ConstructDelegatedRouting(
cfg.Routing.Routers,
cfg.Routing.Methods,
cfg.Identity.PeerID,
cfg.Addresses.Swarm,
cfg.Identity.PrivKey,
)
default:
return fmt.Errorf("unrecognized routing option: %s", routingOption)
}
Expand Down Expand Up @@ -521,6 +533,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
"commit": version.CurrentCommit,
}).Set(1)

// TODO(9285): make metrics more configurable
// initialize metrics collector
prometheus.MustRegister(&corehttp.IpfsNodeCollector{Node: node})

Expand Down Expand Up @@ -641,7 +654,7 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error
// because this would open up the api to scripting vulnerabilities.
// only the webui objects are allowed.
// if you know what you're doing, go ahead and pass --unrestricted-api.
unrestricted, _ := req.Options[unrestrictedApiAccessKwd].(bool)
unrestricted, _ := req.Options[unrestrictedAPIAccessKwd].(bool)
gatewayOpt := corehttp.GatewayOption(false, corehttp.WebUIPaths...)
if unrestricted {
gatewayOpt = corehttp.GatewayOption(true, "/ipfs", "/ipns")
Expand Down
3 changes: 2 additions & 1 deletion cmd/ipfs/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ const (
profileOptionName = "profile"
)

// nolint
var errRepoExists = errors.New(`ipfs configuration file already exists!
Reinitializing would overwrite your keys.
Reinitializing would overwrite your keys
`)

var initCmd = &cmds.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipfs/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
cmds "github.com/ipfs/go-ipfs-cmds"
)

// This is the CLI root, used for executing commands accessible to CLI clients.
// Root is the CLI root, used for executing commands accessible to CLI clients.
// Some subcommands (like 'ipfs daemon' or 'ipfs init') are only accessible here,
// and can't be called through the HTTP API.
var Root = &cmds.Command{
Expand Down
12 changes: 6 additions & 6 deletions cmd/ipfs/pinmfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestPinMFSRootNodeError(t *testing.T) {
}

func TestPinMFSService(t *testing.T) {
cfg_invalid_interval := &config.Config{
cfgInvalidInterval := &config.Config{
Pinning: config.Pinning{
RemoteServices: map[string]config.RemotePinningService{
"disabled": {
Expand All @@ -119,7 +119,7 @@ func TestPinMFSService(t *testing.T) {
},
},
}
cfg_valid_unnamed := &config.Config{
cfgValidUnnamed := &config.Config{
Pinning: config.Pinning{
RemoteServices: map[string]config.RemotePinningService{
"valid_unnamed": {
Expand All @@ -134,7 +134,7 @@ func TestPinMFSService(t *testing.T) {
},
},
}
cfg_valid_named := &config.Config{
cfgValidNamed := &config.Config{
Pinning: config.Pinning{
RemoteServices: map[string]config.RemotePinningService{
"valid_named": {
Expand All @@ -149,9 +149,9 @@ func TestPinMFSService(t *testing.T) {
},
},
}
testPinMFSServiceWithError(t, cfg_invalid_interval, "remote pinning service \"invalid_interval\" has invalid MFS.RepinInterval")
testPinMFSServiceWithError(t, cfg_valid_unnamed, "error while listing remote pins: empty response from remote pinning service")
testPinMFSServiceWithError(t, cfg_valid_named, "error while listing remote pins: empty response from remote pinning service")
testPinMFSServiceWithError(t, cfgInvalidInterval, "remote pinning service \"invalid_interval\" has invalid MFS.RepinInterval")
testPinMFSServiceWithError(t, cfgValidUnnamed, "error while listing remote pins: empty response from remote pinning service")
testPinMFSServiceWithError(t, cfgValidNamed, "error while listing remote pins: empty response from remote pinning service")
}

func testPinMFSServiceWithError(t *testing.T, cfg *config.Config, expectedErrorPrefix string) {
Expand Down
2 changes: 1 addition & 1 deletion config/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type DNS struct {
// https://en.wikipedia.org/wiki/DNS_over_HTTPS
//
// Example:
// - Custom resolver for ENS: `eth.` → `https://eth.link/dns-query`
// - Custom resolver for ENS: `eth.` → `https://dns.eth.limo/dns-query`
// - Override the default OS resolver: `.` → `https://doh.applied-privacy.net/query`
Resolvers map[string]string
// MaxCacheTTL is the maximum duration DNS entries are valid in the cache.
Expand Down
2 changes: 1 addition & 1 deletion config/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Experiments struct {
ShardingEnabled bool `json:",omitempty"` // deprecated by autosharding: https://github.com/ipfs/kubo/pull/8527
GraphsyncEnabled bool
Libp2pStreamMounting bool
P2pHttpProxy bool
P2pHttpProxy bool //nolint
StrategicProviding bool
AcceleratedDHTClient bool
}
7 changes: 7 additions & 0 deletions config/gateway.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package config

const DefaultInlineDNSLink = false

type GatewaySpec struct {
// Paths is explicit list of path prefixes that should be handled by
// this gateway. Example: `["/ipfs", "/ipns", "/api"]`
Expand All @@ -18,6 +20,11 @@ type GatewaySpec struct {
// NoDNSLink configures this gateway to _not_ resolve DNSLink for the FQDN
// provided in `Host` HTTP header.
NoDNSLink bool

// InlineDNSLink configures this gateway to always inline DNSLink names
// (FQDN) into a single DNS label in order to interop with wildcard TLS certs
// and Origin per CID isolation provided by rules like https://publicsuffix.org
InlineDNSLink Flag
}

// Gateway contains options for the HTTP gateway server.
Expand Down
4 changes: 3 additions & 1 deletion config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
},

Routing: Routing{
Type: NewOptionalString("dht"),
Type: "dht",
Methods: nil,
Routers: nil,
},

// setup the node mount points.
Expand Down
2 changes: 1 addition & 1 deletion config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ functionality - performance of content discovery and data
fetching may be degraded.
`,
Transform: func(c *Config) error {
c.Routing.Type = NewOptionalString("dhtclient")
c.Routing.Type = "dhtclient"
c.AutoNAT.ServiceMode = AutoNATServiceDisabled
c.Reprovider.Interval = "0"

Expand Down
Loading

0 comments on commit cf4bf8a

Please sign in to comment.