near

package module
v0.0.0-...-7bf5431 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

README

CoreDNS Near

Description

The CoreDNS Near plugin uses the NEAR DNS smart contract to retrieve the IPFS hash associated with the near account:

ex: testaccount.near.link

Compilation

./build-standalone.sh

Run

./coredns -dns.port 1053

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NEAR

type NEAR struct {
	Next                plugin.Handler
	Client              *nearclient.Client
	NEARDNS             string
	NEARLinkNameServers []string
	IPFSGatewayAs       []string
	IPFSGatewayAAAAs    []string
}

func (NEAR) HasRecords

func (n NEAR) HasRecords(domain string, name string) (bool, error)

func (NEAR) IsAuthoritative

func (n NEAR) IsAuthoritative(domain string) bool

func (NEAR) Name

func (n NEAR) Name() string

Name implements the Handler interface.

func (NEAR) Query

func (n NEAR) Query(domain string, name string, qtype uint16, do bool) ([]dns.RR, error)

func (NEAR) Ready

func (n NEAR) Ready() bool

func (NEAR) ServeDNS

func (n NEAR) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type Result

type Result int

Result of a lookup

const (
	// Success is a successful lookup.
	Success Result = iota
	// NameError indicates a nameerror
	NameError
	// Delegation indicates the lookup resulted in a delegation.
	Delegation
	// NoData indicates the lookup resulted in a NODATA.
	NoData
	// ServerFailure indicates a server failure during the lookup.
	ServerFailure
)

func Lookup

func Lookup(server Server, state request.Request) ([]dns.RR, []dns.RR, []dns.RR, Result)

Lookup contains the logic required to move through A DNS hierarchy and gather the appropriate records

type Server

type Server interface {
	// Query returns records for a specific domain, name, and resource type
	Query(domain string, qname string, qtype uint16, do bool) ([]dns.RR, error)

	// HasRecords checks if there are any records for a specific domain and name
	// This is used to check for wildcard eligibility
	HasRecords(domain string, qname string) (bool, error)

	// IsAuthoritative returns true if this server is authoritative for the
	// supplied domain
	IsAuthoritative(qdomain string) bool
}

Server is an interface defined by any plugin that wishes to serve authoritative records

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL