Documentation ¶
Index ¶
- Constants
- type DefaultServer
- func NewDefaultServer(ctx context.Context, wgInterface WGIface, customAddress string, ...) (*DefaultServer, error)
- func NewDefaultServerIos(ctx context.Context, wgInterface WGIface, iosDnsManager IosDnsManager, ...) *DefaultServer
- func NewDefaultServerPermanentUpstream(ctx context.Context, wgInterface WGIface, hostsDnsList []string, ...) *DefaultServer
- func (s *DefaultServer) DeregisterHandler(domains []string, priority int)
- func (s *DefaultServer) DnsIP() string
- func (s *DefaultServer) Initialize() (err error)
- func (s *DefaultServer) OnUpdatedHostDNSServer(hostsDnsList []string)
- func (s *DefaultServer) ProbeAvailability()
- func (s *DefaultServer) RegisterHandler(domains []string, handler dns.Handler, priority int)
- func (s *DefaultServer) SearchDomains() []string
- func (s *DefaultServer) Stop()
- func (s *DefaultServer) UpdateDNSServer(serial uint64, update nbdns.Config) error
- type DomainConfig
- type HandlerChain
- func (c *HandlerChain) AddHandler(pattern string, handler dns.Handler, priority int, stopHandler handlerWithStop)
- func (c *HandlerChain) HasHandlers(pattern string) bool
- func (c *HandlerChain) RemoveHandler(pattern string, priority int)
- func (c *HandlerChain) ServeDNS(w dns.ResponseWriter, r *dns.Msg)
- type HandlerEntry
- type HostDNSConfig
- type IosDnsManager
- type MockServer
- func (m *MockServer) DeregisterHandler(domains []string, priority int)
- func (m *MockServer) DnsIP() string
- func (m *MockServer) Initialize() error
- func (m *MockServer) OnUpdatedHostDNSServer(strings []string)
- func (m *MockServer) ProbeAvailability()
- func (m *MockServer) RegisterHandler(domains []string, handler dns.Handler, priority int)
- func (m *MockServer) SearchDomains() []string
- func (m *MockServer) Stop()
- func (m *MockServer) UpdateDNSServer(serial uint64, update nbdns.Config) error
- type ReadyListener
- type ResponseWriterChain
- type Server
- type ServiceViaMemory
- type ShutdownState
- type SubdomainMatcher
- type SystemDNSSettings
- type UpstreamResolver
- type WGIface
Constants ¶
const ( PriorityDNSRoute = 100 PriorityMatchDomain = 50 PriorityDefault = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultServer ¶ added in v0.10.7
type DefaultServer struct {
// contains filtered or unexported fields
}
DefaultServer dns server object
func NewDefaultServer ¶ added in v0.10.7
func NewDefaultServer( ctx context.Context, wgInterface WGIface, customAddress string, statusRecorder *peer.Status, stateManager *statemanager.Manager, disableSys bool, ) (*DefaultServer, error)
NewDefaultServer returns a new dns server
func NewDefaultServerIos ¶ added in v0.25.0
func NewDefaultServerIos( ctx context.Context, wgInterface WGIface, iosDnsManager IosDnsManager, statusRecorder *peer.Status, disableSys bool, ) *DefaultServer
NewDefaultServerIos returns a new dns server. It optimized for ios
func NewDefaultServerPermanentUpstream ¶ added in v0.21.9
func NewDefaultServerPermanentUpstream( ctx context.Context, wgInterface WGIface, hostsDnsList []string, config nbdns.Config, listener listener.NetworkChangeListener, statusRecorder *peer.Status, disableSys bool, ) *DefaultServer
NewDefaultServerPermanentUpstream returns a new dns server. It optimized for mobile systems
func (*DefaultServer) DeregisterHandler ¶ added in v0.35.0
func (s *DefaultServer) DeregisterHandler(domains []string, priority int)
func (*DefaultServer) DnsIP ¶ added in v0.21.2
func (s *DefaultServer) DnsIP() string
DnsIP returns the DNS resolver server IP address
When kernel space interface used it return real DNS server listener IP address For bind interface, fake DNS resolver address returned (second last IP address from Nebird network)
func (*DefaultServer) Initialize ¶ added in v0.21.4
func (s *DefaultServer) Initialize() (err error)
Initialize instantiate host manager and the dns service
func (*DefaultServer) OnUpdatedHostDNSServer ¶ added in v0.21.9
func (s *DefaultServer) OnUpdatedHostDNSServer(hostsDnsList []string)
OnUpdatedHostDNSServer update the DNS servers addresses for root zones It will be applied if the mgm server do not enforce DNS settings for root zone
func (*DefaultServer) ProbeAvailability ¶ added in v0.25.5
func (s *DefaultServer) ProbeAvailability()
ProbeAvailability tests each upstream group's servers for availability and deactivates the group if no server responds
func (*DefaultServer) RegisterHandler ¶ added in v0.35.0
func (s *DefaultServer) RegisterHandler(domains []string, handler dns.Handler, priority int)
func (*DefaultServer) SearchDomains ¶ added in v0.24.3
func (s *DefaultServer) SearchDomains() []string
func (*DefaultServer) UpdateDNSServer ¶ added in v0.10.7
func (s *DefaultServer) UpdateDNSServer(serial uint64, update nbdns.Config) error
UpdateDNSServer processes an update received from the management service
type DomainConfig ¶ added in v0.25.0
type HandlerChain ¶ added in v0.35.0
type HandlerChain struct {
// contains filtered or unexported fields
}
HandlerChain represents a prioritized chain of DNS handlers
func NewHandlerChain ¶ added in v0.35.0
func NewHandlerChain() *HandlerChain
func (*HandlerChain) AddHandler ¶ added in v0.35.0
func (c *HandlerChain) AddHandler(pattern string, handler dns.Handler, priority int, stopHandler handlerWithStop)
AddHandler adds a new handler to the chain, replacing any existing handler with the same pattern and priority
func (*HandlerChain) HasHandlers ¶ added in v0.35.0
func (c *HandlerChain) HasHandlers(pattern string) bool
HasHandlers returns true if there are any handlers remaining for the given pattern
func (*HandlerChain) RemoveHandler ¶ added in v0.35.0
func (c *HandlerChain) RemoveHandler(pattern string, priority int)
RemoveHandler removes a handler for the given pattern and priority
func (*HandlerChain) ServeDNS ¶ added in v0.35.0
func (c *HandlerChain) ServeDNS(w dns.ResponseWriter, r *dns.Msg)
type HandlerEntry ¶ added in v0.35.0
type HostDNSConfig ¶ added in v0.25.0
type HostDNSConfig struct { Domains []DomainConfig `json:"domains"` RouteAll bool `json:"routeAll"` ServerIP string `json:"serverIP"` ServerPort int `json:"serverPort"` }
type IosDnsManager ¶ added in v0.25.0
type IosDnsManager interface {
ApplyDns(string)
}
IosDnsManager is a dns manager interface for iOS
type MockServer ¶ added in v0.10.7
type MockServer struct { InitializeFunc func() error StopFunc func() UpdateDNSServerFunc func(serial uint64, update nbdns.Config) error RegisterHandlerFunc func([]string, dns.Handler, int) DeregisterHandlerFunc func([]string, int) }
MockServer is the mock instance of a dns server
func (*MockServer) DeregisterHandler ¶ added in v0.35.0
func (m *MockServer) DeregisterHandler(domains []string, priority int)
func (*MockServer) DnsIP ¶ added in v0.21.2
func (m *MockServer) DnsIP() string
func (*MockServer) Initialize ¶ added in v0.21.4
func (m *MockServer) Initialize() error
Initialize mock implementation of Initialize from Server interface
func (*MockServer) OnUpdatedHostDNSServer ¶ added in v0.21.9
func (m *MockServer) OnUpdatedHostDNSServer(strings []string)
func (*MockServer) ProbeAvailability ¶ added in v0.25.5
func (m *MockServer) ProbeAvailability()
ProbeAvailability mocks implementation of ProbeAvailability from the Server interface
func (*MockServer) RegisterHandler ¶ added in v0.35.0
func (m *MockServer) RegisterHandler(domains []string, handler dns.Handler, priority int)
func (*MockServer) SearchDomains ¶ added in v0.24.3
func (m *MockServer) SearchDomains() []string
func (*MockServer) Stop ¶ added in v0.10.7
func (m *MockServer) Stop()
Stop mock implementation of Stop from Server interface
func (*MockServer) UpdateDNSServer ¶ added in v0.10.7
func (m *MockServer) UpdateDNSServer(serial uint64, update nbdns.Config) error
UpdateDNSServer mock implementation of UpdateDNSServer from Server interface
type ReadyListener ¶ added in v0.21.9
type ReadyListener interface {
OnReady()
}
ReadyListener is a notification mechanism what indicate the server is ready to handle host dns address changes
type ResponseWriterChain ¶ added in v0.35.0
type ResponseWriterChain struct { dns.ResponseWriter // contains filtered or unexported fields }
ResponseWriterChain wraps a dns.ResponseWriter to track if handler wants to continue chain
func (*ResponseWriterChain) GetOrigPattern ¶ added in v0.35.0
func (w *ResponseWriterChain) GetOrigPattern() string
GetOrigPattern returns the original pattern of the handler that wrote the response
type Server ¶
type Server interface { RegisterHandler(domains []string, handler dns.Handler, priority int) DeregisterHandler(domains []string, priority int) Initialize() error Stop() DnsIP() string UpdateDNSServer(serial uint64, update nbdns.Config) error OnUpdatedHostDNSServer(strings []string) SearchDomains() []string ProbeAvailability() }
Server is a dns server interface
func GetServerDns ¶ added in v0.21.9
GetServerDns export the DNS server instance in static way. It used by the Mobile client
type ServiceViaMemory ¶ added in v0.28.7
type ServiceViaMemory struct {
// contains filtered or unexported fields
}
func NewServiceViaMemory ¶ added in v0.28.7
func NewServiceViaMemory(wgIface WGIface) *ServiceViaMemory
func (*ServiceViaMemory) DeregisterMux ¶ added in v0.28.7
func (s *ServiceViaMemory) DeregisterMux(pattern string)
func (*ServiceViaMemory) Listen ¶ added in v0.28.7
func (s *ServiceViaMemory) Listen() error
func (*ServiceViaMemory) RegisterMux ¶ added in v0.28.7
func (s *ServiceViaMemory) RegisterMux(pattern string, handler dns.Handler)
func (*ServiceViaMemory) RuntimeIP ¶ added in v0.28.7
func (s *ServiceViaMemory) RuntimeIP() string
func (*ServiceViaMemory) RuntimePort ¶ added in v0.28.7
func (s *ServiceViaMemory) RuntimePort() int
func (*ServiceViaMemory) Stop ¶ added in v0.28.7
func (s *ServiceViaMemory) Stop()
type ShutdownState ¶ added in v0.30.3
func (*ShutdownState) Cleanup ¶ added in v0.30.3
func (s *ShutdownState) Cleanup() error
func (*ShutdownState) Name ¶ added in v0.30.3
func (s *ShutdownState) Name() string
type SubdomainMatcher ¶ added in v0.35.0
type SystemDNSSettings ¶ added in v0.28.5
type UpstreamResolver ¶ added in v0.25.0
type UpstreamResolver interface {
// contains filtered or unexported methods
}
type WGIface ¶ added in v0.21.9
type WGIface interface { Name() string Address() iface.WGAddress ToInterface() *net.Interface IsUserspaceBind() bool GetFilter() device.PacketFilter GetDevice() *device.FilteredDevice GetStats(peerKey string) (configurer.WGStats, error) }
WGIface defines subset methods of interface required for manager
Source Files ¶
- consts.go
- dbus_unix.go
- file_parser_unix.go
- file_repair_unix.go
- file_unix.go
- handler_chain.go
- host.go
- host_unix.go
- hosts_dns_holder.go
- local.go
- mock_server.go
- network_manager_unix.go
- notifier.go
- resolvconf_unix.go
- response_writer.go
- server.go
- server_export.go
- server_unix.go
- service.go
- service_listener.go
- service_memory.go
- systemd_linux.go
- unclean_shutdown_unix.go
- upstream.go
- upstream_general.go
- wgiface.go