Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
REPO="$(mktemp -d)"
IPFS_PATH="$REPO"
trap "$(printf 'rm -rf "%s"' "$REPO")" INT EXIT
ipfs init >/dev/null
ipfs daemon --routing=dhtclient >&2 &
#!/bin/bash
REPO="$(mktemp -d)"
IPFS_PATH="$REPO"
trap "$(printf 'rm -rf "%s"' "$REPO")" INT EXIT
ipfs init --profile=randomports >/dev/null
ipfs daemon --routing=dhtclient >&2 &
#!/bin/bash
REPO="$(mktemp -d)"
IPFS_PATH="$REPO"
trap "$(printf 'rm -rf "%s"' "$REPO")" INT EXIT
ipfs init --profile=randomports >/dev/null
ipfs config Addresses.API "/ip4/127.0.0.1/tcp/0" # random API port.
#!/bin/bash
REPO="$(mktemp -d)"
IPFS_PATH="$REPO"
trap "$(printf 'rm -rf "%s"' "$REPO")" INT EXIT
ipfs init >/dev/null
ipfs daemon --routing=dhtclient >&2 &
goroutine 0 [idle]:
runtime.futex(0x24fc908, 0x80, 0x0, 0x0, 0x0, 0x7ace00000000, 0x0, 0x0, 0x7ace370afa20, 0x9d7d31, ...)
/usr/lib/go/src/runtime/sys_linux_amd64.s:535 +0x21
runtime.futexsleep(0x24fc908, 0x7ace00000000, 0xffffffffffffffff)
/usr/lib/go/src/runtime/os_linux.go:46 +0x4b
runtime.notesleep(0x24fc908)
/usr/lib/go/src/runtime/lock_futex.go:151 +0xa1
runtime.stoplockedm()
/usr/lib/go/src/runtime/proc.go:2076 +0x8c
runtime.schedule()
package keyrange
type Bound struct {
Value string
Exclusive bool
}
func (b Bound) Open() bool {
return b == Bound{} // zero value is "open"
}
package main
import (
"net"
"sync"
"syscall"
)
func setFdLimit(limit uint64) {
var rLimit syscall.Rlimit
#!/bin/bash
export IPFS_GATEWAY="${IPFS_GATEWAY:-http://127.0.0.1:8080}"
CACHE_DIR="$(go env GOPATH)/pkg/mod/cache"
basepath() {
echo "${1##${CACHE_DIR}/download/}"
}
#!/bin/bash
export IPFS_GATEWAY="${IPFS_GATEWAY:-http://127.0.0.1:8080}"
CACHE_DIR="$(go env GOPATH)/pkg/mod/cache"
basepath() {
echo "${1##${CACHE_DIR}/download/}"
}

Unified Path Namespace

In the strict UNIX philosophy, everything is a file. This breaks down in practice as dealing with streams and bytes everywhere is annoying at best however, it gets one thing right: all "identifiers" live in the same, unambiguous namespace.

We're already part of the way there. We have:

Data paths: