Documentation ¶
Index ¶
- func DNSDialer(port int) func(ctx context.Context, network, address string) (net.Conn, error)
- type DmDns
- func (s *DmDns) AddRecord(domain string, rtype uint16, rr dns.RR)
- func (s *DmDns) DNSOverTCP(in io.ReadCloser, out io.Writer) error
- func (s *DmDns) ForwardRealDNS(req *dns.Msg) (*dns.Msg, error)
- func (gw *DmDns) HandleUdp(dstAddr net.IP, dstPort uint16, localAddr net.IP, localPort uint16, ...)
- func (s *DmDns) HostByAddr(addr string) (string, bool)
- func (s *DmDns) HttpDebugDNS(w http.ResponseWriter, r *http.Request)
- func (s *DmDns) IPResolve(ip string) string
- func (s *DmDns) NameByAddr(addr string) (*DnsEntry, bool)
- func (s *DmDns) Process(req *dns.Msg) *dns.Msg
- func (s *DmDns) Serve()
- func (s *DmDns) Start(mux *http.ServeMux)
- type DnsEntry
- type UdpWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DmDns ¶
type DmDns struct { UDPConn *net.UDPConn // UDP // Capture return - sends packets back to client app. // This is typically a netstack or TProxy UDPWriter UdpWriter // Client used for communicating with the gateway - should be capable of H2, and have // all authetication set up. H2 *http.Client // Address and port for the DNS-over-https gateway. If empty, direct calls // using dnsUDPClient. BaseUrl string Port int // contains filtered or unexported fields }
func (*DmDns) DNSOverTCP ¶
DNSOverTCP implements DNS over TCP protocol. Used in TCP capture, for port 53. TODO: also as a standalone server.
func (*DmDns) ForwardRealDNS ¶
ForwardRealDNS sends the query to real nameservers.
func (*DmDns) HandleUdp ¶
func (gw *DmDns) HandleUdp(dstAddr net.IP, dstPort uint16, localAddr net.IP, localPort uint16, data []byte)
Special capture for DNS. Will use the DNS VPN or direct calls.
func (*DmDns) HostByAddr ¶
HostByAddr returns the last lookup address for an IP, or the original address. The IP is expressed as a string ( ip.String() ).
func (*DmDns) HttpDebugDNS ¶
func (s *DmDns) HttpDebugDNS(w http.ResponseWriter, r *http.Request)
HttpDebugDNS dumps DNS cache (dnsByName)
func (*DmDns) NameByAddr ¶
Given an IPv4 or IPv6 address, return the name if DNS was used.
func (*DmDns) Process ¶
Process resolves a query by forwarding to a recursive nameserver or handling it locally. This is the main function - can be called from: - the real local UDP DNS (mike's) - DNS-over-TCP or TLS server - captured UDP:53 from TUN
Wrapps the real process method with stats gathering and builds a reverse map of IP to names
type DnsEntry ¶
type DnsEntry struct { // DNS name, with trailing . Name string IP net.IP // Number of times it was called. Count int RCount int // Latency on getting the entry Lat time.Duration // contains filtered or unexported fields }
Info and stats about a DNS entry.
type UdpWriter ¶
type UdpWriter interface {
WriteTo(data []byte, dstAddr *net.UDPAddr, srcAddr *net.UDPAddr) (int, error)
}
UdpWriter is the interface implemented by the TunTransport, to send packets back to the virtual interface Set by TProxy and TUN capture. If missing, a regular UDP will be used, first with WriteMsgUdp and if it fails without preserving srcAddr.