Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import (
"github.com/ipfs/boxo/bitswap/message/pb"
"github.com/ipfs/boxo/bitswap/network"
"github.com/ipfs/boxo/bitswap/network/httpnet"
"github.com/ipfs/boxo/gateway"
"github.com/ipfs/boxo/namesys"
"github.com/ipfs/boxo/routing/http/client"
"github.com/ipfs/boxo/routing/http/contentrouter"
"github.com/ipfs/go-cid"
vole "github.com/ipshipyard/vole/lib"
doh "github.com/libp2p/go-doh-resolver"
"github.com/libp2p/go-libp2p"
dhtpb "github.com/libp2p/go-libp2p-kad-dht/pb"
"github.com/libp2p/go-libp2p/core/host"
Expand All @@ -37,6 +40,7 @@ type daemon struct {
h host.Host
dht kademlia
dhtMessenger *dhtpb.ProtocolMessenger
ns namesys.NameSystem
createTestHost func() (host.Host, error)
promRegistry *prometheus.Registry
httpSkipVerify bool
Expand Down Expand Up @@ -90,10 +94,34 @@ func newDaemon(ctx context.Context, acceleratedDHT bool) (*daemon, error) {
return nil, err
}

// Create DNS resolver with delegated-ipfs.dev DoH endpoint to match IPFS Mainnet behavior.
// This endpoint is used by the Helia ecosystem in browsers and ensures consistent
// DNSLink resolution without requiring local DNS resolver configuration.
// DNS caching is disabled (doh.WithCacheDisabled) because this is a diagnostic tool
// that should always query current DNS state rather than serve potentially stale cached results.
dnsResolver, err := gateway.NewDNSResolver(
map[string]string{
".": "https://delegated-ipfs.dev/dns-query",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine for now, but a little awkward given how for whatever reason there's an IPNI endpoint configurable.

},
doh.WithCacheDisabled(),
)
if err != nil {
return nil, fmt.Errorf("failed to create DNS resolver: %w", err)
}

// Create namesys without caching (no WithCache option) to ensure fresh IPNS resolution.
// Diagnostic tools should not cache IPNS records as users expect to see current network state
// when running checks, not cached data from previous resolutions.
ns, err := namesys.NewNameSystem(d, namesys.WithDNSResolver(dnsResolver))
if err != nil {
return nil, err
}

return &daemon{
h: h,
dht: d,
dhtMessenger: pm,
ns: ns,
promRegistry: promRegistry,
createTestHost: func() (host.Host, error) {
// TODO: when behind NAT, this will fail to determine its own public addresses which will block it from running dctur and hole punching
Expand All @@ -106,6 +134,14 @@ func newDaemon(ctx context.Context, acceleratedDHT bool) (*daemon, error) {
}}, nil
}

type MutableResolution struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can kick the can down the road here, but I wonder if adding some explicit versioning to the backend would help us here with upgrades and not feeling bad about shipping something rough and needs to be improved later but that's net an improvement.

InputPath string `json:"InputPath,omitempty"`
ResolvedPath string `json:"ResolvedPath,omitempty"`
DiagnosticURL string `json:"DiagnosticURL,omitempty"`
Error string `json:"Error,omitempty"`
IsMutableInput bool `json:"IsMutableInput,omitempty"`
}

type cidCheckOutput *[]providerOutput

type providerOutput struct {
Expand Down
18 changes: 18 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/ipfs/go-datastore v0.9.0
github.com/ipfs/go-ipld-format v0.6.3
github.com/ipshipyard/vole v0.0.0-20251030190237-1448fb4935ac
github.com/libp2p/go-doh-resolver v0.5.0
github.com/libp2p/go-libp2p v0.43.0
github.com/libp2p/go-libp2p-kad-dht v0.35.1
github.com/libp2p/go-libp2p-record v0.3.1
Expand All @@ -26,21 +27,26 @@ require (
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cheggaaa/pb/v3 v3.1.7 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20241020182519-7843d2ba8fdf // indirect
github.com/cskr/pubsub v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/filecoin-project/go-clock v0.1.0 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
github.com/gammazero/chanqueue v1.1.1 // indirect
github.com/gammazero/deque v1.1.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
Expand All @@ -56,13 +62,18 @@ require (
github.com/huin/goupnp v1.3.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-bitfield v1.1.0 // indirect
github.com/ipfs/go-cidutil v0.1.0 // indirect
github.com/ipfs/go-dsqueue v0.1.0 // indirect
github.com/ipfs/go-ipfs-pq v0.0.3 // indirect
github.com/ipfs/go-ipfs-redirects-file v0.1.2 // indirect
github.com/ipfs/go-ipld-cbor v0.2.1 // indirect
github.com/ipfs/go-ipld-legacy v0.2.2 // indirect
github.com/ipfs/go-log/v2 v2.8.2 // indirect
github.com/ipfs/go-metrics-interface v0.3.0 // indirect
github.com/ipfs/go-peertaskqueue v0.8.2 // indirect
github.com/ipfs/go-unixfsnode v1.10.2 // indirect
github.com/ipld/go-car/v2 v2.16.0 // indirect
github.com/ipld/go-codec-dagpb v1.7.0 // indirect
github.com/ipld/go-ipld-prime v0.21.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
Expand Down Expand Up @@ -102,6 +113,7 @@ require (
github.com/nxadm/tail v1.4.11 // indirect
github.com/onsi/gomega v1.36.3 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect
github.com/pion/datachannel v1.5.10 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/dtls/v3 v3.0.6 // indirect
Expand Down Expand Up @@ -135,8 +147,12 @@ require (
github.com/sergi/go-diff v1.3.1 // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/ucarion/urlpath v0.0.0-20200424170820-7ccc79b76bbb // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect
github.com/whyrusleeping/cbor-gen v0.3.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All @@ -148,6 +164,7 @@ require (
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
Expand All @@ -167,6 +184,7 @@ require (
golang.org/x/text v0.30.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.38.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading