dns

package
v3.17.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryTimeout = time.Second * 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ARecord added in v1.13.1

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

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 []*v2ray_core_common_net2.Endpoint `protobuf:"bytes,1,rep,name=NameServers" json:"NameServers,omitempty"`
	// Static hosts. Domain to IP.
	Hosts map[string]*v2ray_core_common_net.IPOrDomain `` /* 130-byte string literal not displayed */
}

func (*Config) Descriptor

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

func (*Config) GetHosts

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

func (*Config) GetInternalHosts

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

func (*Config) GetNameServers

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

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

type DomainRecord added in v1.13.1

type DomainRecord struct {
	IP         []net.IP
	Expire     time.Time
	LastAccess time.Time
}

func (*DomainRecord) Expired

func (r *DomainRecord) Expired() bool

type LocalNameServer added in v1.13.1

type LocalNameServer struct {
}

func (*LocalNameServer) QueryA added in v1.13.1

func (*LocalNameServer) QueryA(domain string) <-chan *ARecord

type NameServer

type NameServer interface {
	QueryA(domain string) <-chan *ARecord
}

type PendingRequest added in v1.13.1

type PendingRequest struct {
	// contains filtered or unexported fields
}

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) GetCached

func (s *Server) GetCached(domain string) []net.IP

func (*Server) LookupIP

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

func (*Server) Start

func (s *Server) Start() error

Start implements common.Runnable.

type UDPNameServer added in v1.13.1

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

func NewUDPNameServer added in v1.13.1

func NewUDPNameServer(address net.Destination, dispatcher core.Dispatcher) *UDPNameServer

func (*UDPNameServer) AssignUnusedID added in v1.13.1

func (s *UDPNameServer) AssignUnusedID(response chan<- *ARecord) uint16

func (*UDPNameServer) Cleanup added in v1.13.1

func (s *UDPNameServer) Cleanup() error

func (*UDPNameServer) HandleResponse added in v1.13.1

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

func (*UDPNameServer) QueryA added in v1.13.1

func (s *UDPNameServer) QueryA(domain string) <-chan *ARecord

Jump to

Keyboard shortcuts

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