Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

add DNS interface #69

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions coreapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type CoreAPI interface {
// PubSub returns an implementation of PubSub API
PubSub() PubSubAPI

// DNS returns an implementation of DNS API
DNS() DNSAPI
Copy link
Contributor

Choose a reason for hiding this comment

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

@Stebalien do we want to expose a DNS API in the CoreAPI? It seems like it's not really the intention as the CoreAPI is supposed to deal with how an IPNS node functions not just acting as a wrapper around all low level go-ipfs commands.

@vyzo the alternative to using the CoreAPI in your go-ipfs PR would be to just define the function on the IpfsNode and use cmdenv.GetNode(env, req) instead of GetApi

Copy link
Author

Choose a reason for hiding this comment

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

Also note that we can make the DNS api wider, we have a couple of more methods that would be useful to expose -- LookupIPAddr for straight up dns resolution and Resolve for multiaddr resolution.

Copy link
Member

Choose a reason for hiding this comment

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

I really don't think we want to expose this as it has nothing to do with IPFS.


// ResolvePath resolves the path using Unixfs resolver
ResolvePath(context.Context, path.Path) (path.Resolved, error)

Expand Down
9 changes: 9 additions & 0 deletions dns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package iface

import (
"context"
)

type DNSAPI interface {
LookupTXT(ctx context.Context, name string) (txt []string, err error)
}