dns

package
v3.46.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package dns is an implementation of core.DNS feature.

Index

Constants

This section is empty.

Variables

View Source
var DomainMatchingType_name = map[int32]string{
	0: "Full",
	1: "Subdomain",
	2: "Keyword",
	3: "Regex",
}
View Source
var DomainMatchingType_value = map[string]int32{
	"Full":      0,
	"Subdomain": 1,
	"Keyword":   2,
	"Regex":     3,
}

Functions

func NewLocalNameServer added in v3.27.1

func NewLocalNameServer() *localNameServer

Types

type ClassicNameServer added in v3.27.1

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

func NewClassicNameServer added in v3.27.1

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

func (*ClassicNameServer) Cleanup added in v3.27.1

func (s *ClassicNameServer) Cleanup() error

func (*ClassicNameServer) HandleResponse added in v3.27.1

func (s *ClassicNameServer) HandleResponse(ctx context.Context, payload *buf.Buffer)

func (*ClassicNameServer) QueryIP added in v3.27.1

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,proto3" json:"NameServers,omitempty"` // Deprecated: Do not use.
	// NameServer list used by this DNS client.
	NameServer []*NameServer `protobuf:"bytes,5,rep,name=name_server,json=nameServer,proto3" json:"name_server,omitempty"`
	// Static hosts. Domain to IP.
	// Deprecated. Use static_hosts.
	Hosts map[string]*net.IPOrDomain `` // Deprecated: Do not use.
	/* 151-byte string literal not displayed */
	// Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes (IPv6).
	ClientIp             []byte                `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
	StaticHosts          []*Config_HostMapping `protobuf:"bytes,4,rep,name=static_hosts,json=staticHosts,proto3" json:"static_hosts,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}

func (*Config) Descriptor

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

func (*Config) GetClientIp added in v3.27.1

func (m *Config) GetClientIp() []byte

func (*Config) GetHosts deprecated

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

Deprecated: Do not use.

func (*Config) GetNameServer added in v3.37.1

func (m *Config) GetNameServer() []*NameServer

func (*Config) GetNameServers deprecated

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

Deprecated: Do not use.

func (*Config) GetStaticHosts added in v3.27.1

func (m *Config) GetStaticHosts() []*Config_HostMapping

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 added in v3.23.1

func (m *Config) XXX_DiscardUnknown()

func (*Config) XXX_Marshal added in v3.23.1

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

func (*Config) XXX_Merge added in v3.23.1

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

func (*Config) XXX_Size added in v3.23.1

func (m *Config) XXX_Size() int

func (*Config) XXX_Unmarshal added in v3.23.1

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

type Config_HostMapping added in v3.27.1

type Config_HostMapping struct {
	Type                 DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"`
	Domain               string             `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	Ip                   [][]byte           `protobuf:"bytes,3,rep,name=ip,proto3" json:"ip,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*Config_HostMapping) Descriptor added in v3.27.1

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

func (*Config_HostMapping) GetDomain added in v3.27.1

func (m *Config_HostMapping) GetDomain() string

func (*Config_HostMapping) GetIp added in v3.27.1

func (m *Config_HostMapping) GetIp() [][]byte

func (*Config_HostMapping) GetType added in v3.27.1

func (*Config_HostMapping) ProtoMessage added in v3.27.1

func (*Config_HostMapping) ProtoMessage()

func (*Config_HostMapping) Reset added in v3.27.1

func (m *Config_HostMapping) Reset()

func (*Config_HostMapping) String added in v3.27.1

func (m *Config_HostMapping) String() string

func (*Config_HostMapping) XXX_DiscardUnknown added in v3.27.1

func (m *Config_HostMapping) XXX_DiscardUnknown()

func (*Config_HostMapping) XXX_Marshal added in v3.27.1

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

func (*Config_HostMapping) XXX_Merge added in v3.27.1

func (m *Config_HostMapping) XXX_Merge(src proto.Message)

func (*Config_HostMapping) XXX_Size added in v3.27.1

func (m *Config_HostMapping) XXX_Size() int

func (*Config_HostMapping) XXX_Unmarshal added in v3.27.1

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

type DomainMatchingType added in v3.37.1

type DomainMatchingType int32
const (
	DomainMatchingType_Full      DomainMatchingType = 0
	DomainMatchingType_Subdomain DomainMatchingType = 1
	DomainMatchingType_Keyword   DomainMatchingType = 2
	DomainMatchingType_Regex     DomainMatchingType = 3
)

func (DomainMatchingType) EnumDescriptor added in v3.37.1

func (DomainMatchingType) EnumDescriptor() ([]byte, []int)

func (DomainMatchingType) String added in v3.37.1

func (x DomainMatchingType) String() string

type IPRecord added in v3.27.1

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

type NameServer added in v3.8.1

type NameServer struct {
	Address              *net.Endpoint                `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	PrioritizedDomain    []*NameServer_PriorityDomain `protobuf:"bytes,2,rep,name=prioritized_domain,json=prioritizedDomain,proto3" json:"prioritized_domain,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
	XXX_unrecognized     []byte                       `json:"-"`
	XXX_sizecache        int32                        `json:"-"`
}

func (*NameServer) Descriptor added in v3.37.1

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

func (*NameServer) GetAddress added in v3.37.1

func (m *NameServer) GetAddress() *net.Endpoint

func (*NameServer) GetPrioritizedDomain added in v3.37.1

func (m *NameServer) GetPrioritizedDomain() []*NameServer_PriorityDomain

func (*NameServer) ProtoMessage added in v3.37.1

func (*NameServer) ProtoMessage()

func (*NameServer) Reset added in v3.37.1

func (m *NameServer) Reset()

func (*NameServer) String added in v3.37.1

func (m *NameServer) String() string

func (*NameServer) XXX_DiscardUnknown added in v3.37.1

func (m *NameServer) XXX_DiscardUnknown()

func (*NameServer) XXX_Marshal added in v3.37.1

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

func (*NameServer) XXX_Merge added in v3.37.1

func (m *NameServer) XXX_Merge(src proto.Message)

func (*NameServer) XXX_Size added in v3.37.1

func (m *NameServer) XXX_Size() int

func (*NameServer) XXX_Unmarshal added in v3.37.1

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

type NameServerInterface added in v3.37.1

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

type NameServer_PriorityDomain added in v3.37.1

type NameServer_PriorityDomain struct {
	Type                 DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"`
	Domain               string             `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*NameServer_PriorityDomain) Descriptor added in v3.37.1

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

func (*NameServer_PriorityDomain) GetDomain added in v3.37.1

func (m *NameServer_PriorityDomain) GetDomain() string

func (*NameServer_PriorityDomain) GetType added in v3.37.1

func (*NameServer_PriorityDomain) ProtoMessage added in v3.37.1

func (*NameServer_PriorityDomain) ProtoMessage()

func (*NameServer_PriorityDomain) Reset added in v3.37.1

func (m *NameServer_PriorityDomain) Reset()

func (*NameServer_PriorityDomain) String added in v3.37.1

func (m *NameServer_PriorityDomain) String() string

func (*NameServer_PriorityDomain) XXX_DiscardUnknown added in v3.37.1

func (m *NameServer_PriorityDomain) XXX_DiscardUnknown()

func (*NameServer_PriorityDomain) XXX_Marshal added in v3.37.1

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

func (*NameServer_PriorityDomain) XXX_Merge added in v3.37.1

func (m *NameServer_PriorityDomain) XXX_Merge(src proto.Message)

func (*NameServer_PriorityDomain) XXX_Size added in v3.37.1

func (m *NameServer_PriorityDomain) XXX_Size() int

func (*NameServer_PriorityDomain) XXX_Unmarshal added in v3.37.1

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

type Server

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

func New added in v3.8.1

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

func (*Server) Close added in v3.8.1

func (s *Server) Close() error

Close implements common.Closable.

func (*Server) LookupIP added in v3.8.1

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

func (*Server) Start added in v3.8.1

func (s *Server) Start() error

Start implements common.Runnable.

type StaticHosts added in v3.27.1

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

func NewStaticHosts added in v3.27.1

func NewStaticHosts(hosts []*Config_HostMapping, legacy map[string]*net.IPOrDomain) (*StaticHosts, error)

func (*StaticHosts) LookupIP added in v3.27.1

func (h *StaticHosts) LookupIP(domain string) []net.IP

Jump to

Keyboard shortcuts

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