dns

package
v3.1.13+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT, MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dns is an implementation of core.DNS feature.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARecord

type ARecord struct {
	IPs    []net.IP
	Expire time.Time
}

type ClassicNameServer

type ClassicNameServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewClassicNameServer

func NewClassicNameServer(address net.Destination, dispatcher core.Dispatcher) *ClassicNameServer

func (*ClassicNameServer) Cleanup

func (s *ClassicNameServer) Cleanup() error

func (*ClassicNameServer) HandleResponse

func (s *ClassicNameServer) HandleResponse(payload *buf.Buffer)

func (*ClassicNameServer) QueryIP

func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string) ([]net.IP, error)

type Config

type Config struct {
	// Nameservers used by this DNS. Only traditional UDP servers are support at the moment.
	// A special value 'localhost' as a domain address can be set to use DNS on local system.
	NameServers []*net.Endpoint `protobuf:"bytes,1,rep,name=NameServers" json:"NameServers,omitempty"`
	// Static hosts. Domain to IP.
	Hosts                map[string]*net.IPOrDomain `` /* 130-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetHosts

func (m *Config) GetHosts() map[string]*net.IPOrDomain

func (*Config) GetInternalHosts

func (c *Config) GetInternalHosts() map[string]net.IP

func (*Config) GetNameServers

func (m *Config) GetNameServers() []*net.Endpoint

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

func (*Config) XXX_DiscardUnknown

func (m *Config) XXX_DiscardUnknown()

func (*Config) XXX_Marshal

func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Config) XXX_Merge

func (dst *Config) XXX_Merge(src proto.Message)

func (*Config) XXX_Size

func (m *Config) XXX_Size() int

func (*Config) XXX_Unmarshal

func (m *Config) XXX_Unmarshal(b []byte) error

type IPRecord

type IPRecord struct {
	IP     net.IP
	Expire time.Time
}

type LocalNameServer

type LocalNameServer struct {
}

func (*LocalNameServer) QueryIP

func (*LocalNameServer) QueryIP(ctx context.Context, domain string) ([]net.IP, error)

type NameServer

type NameServer interface {
	QueryIP(ctx context.Context, domain string) ([]net.IP, error)
}

type Server

type Server struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, config *Config) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

Close implements common.Closable.

func (*Server) LookupIP

func (s *Server) LookupIP(domain string) ([]net.IP, error)

func (*Server) Start

func (s *Server) Start() error

Start implements common.Runnable.

Jump to

Keyboard shortcuts

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