store

package
v0.0.0-...-5abfbfe Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package store provides an interface to store and retrieve custom DNS records

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultStore

type DefaultStore struct {
	*tree.Tree
}

DefaultStore implements a default store based on a in-memory tree structure

func NewDefault

func NewDefault() *DefaultStore

func (*DefaultStore) Add

func (s *DefaultStore) Add(name string, records []rr.RR) error

Add adds a new resource record to the store

func (*DefaultStore) Get

func (s *DefaultStore) Get(name string, class, t uint16) ([]rr.RR, error)

Get returns a record by name and the selected type's data. Example: example.com with type A would return 93.184.216.34

func (*DefaultStore) GetFromQuestion

func (s *DefaultStore) GetFromQuestion(question dns.Question) ([]rr.RR, error)

GetFromQuestion returns a record by name and the selected type's data. Example: example.com with type A would return 93.184.216.34

type Store

type Store interface {
	// GetFromQuestion returns records by name and the selected type's data.
	// Example: example.com with type A would return 93.184.216.34
	GetFromQuestion(dns.Question) ([]rr.RR, error)

	// Get returns records by name and the selected type's data.
	// Example: example.com with type A would return 93.184.216.34
	Get(string, uint16, uint16) ([]rr.RR, error)

	// Add adds a new resource records to the store
	Add(string, []rr.RR) error
}

Jump to

Keyboard shortcuts

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