-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add IPNS and DNSLink resolution support #114
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
|
|
@@ -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 | ||
|
|
@@ -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", | ||
| }, | ||
| 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 | ||
|
|
@@ -106,6 +134,14 @@ func newDaemon(ctx context.Context, acceleratedDHT bool) (*daemon, error) { | |
| }}, nil | ||
| } | ||
|
|
||
| type MutableResolution struct { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Seems fine for now, but a little awkward given how for whatever reason there's an IPNI endpoint configurable.