rs / Dnscache
Licence: mit
DNS lookup cache for Go
Stars: ✭ 115
Labels
Projects that are alternatives of or similar to Dnscache
Bass
Bass grabs you those "extra resolvers" you are missing out on when performing Active DNS enumeration. Add anywhere from 100-6k resolvers to your "resolver.txt"
Stars: ✭ 104 (-9.57%)
Mutual labels: dns
Knowledge
文档着重构建一个完整的「前端技术架构图谱」,方便 F2E(Front End Engineering又称FEE、F2E) 学习与进阶。
Stars: ✭ 1,620 (+1308.7%)
Mutual labels: dns
Gitzone
git-based zone management tool for static and dynamic domains
Stars: ✭ 100 (-13.04%)
Mutual labels: dns
Vagrant Hostmanager
📝 A Vagrant plugin that manages hosts files within a multi-machine environment.
Stars: ✭ 1,442 (+1153.91%)
Mutual labels: dns
Collection Document
Collection of quality safety articles. Awesome articles.
Stars: ✭ 1,387 (+1106.09%)
Mutual labels: dns
Cloudflare Ddns
Script for dynamically updating a CloudFlare DNS record. (Deprecated)
Stars: ✭ 112 (-2.61%)
Mutual labels: dns
Rita
Real Intelligence Threat Analytics (RITA) is a framework for detecting command and control communication through network traffic analysis.
Stars: ✭ 1,352 (+1075.65%)
Mutual labels: dns
Kubernetes Pfsense Controller
Integrate Kubernetes and pfSense
Stars: ✭ 100 (-13.04%)
Mutual labels: dns
Glider
glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
Stars: ✭ 1,710 (+1386.96%)
Mutual labels: dns
Dns Discovery
DNS-Discovery is a multithreaded subdomain bruteforcer.
Stars: ✭ 114 (-0.87%)
Mutual labels: dns
Outis
outis is a custom Remote Administration Tool (RAT) or something like that. It was build to support various transport methods (like DNS) and platforms (like Powershell).
Stars: ✭ 111 (-3.48%)
Mutual labels: dns
DNS Lookup Cache
The dnscache package provides a DNS cache layer to Go's net.Resolver
.
Install
Install using the "go get" command:
go get -u github.com/rs/dnscache
Usage
Create a new instance and use it in place of net.Resolver
. New names will be cached. Call the Refresh
method at regular interval to update cached entries and cleanup unused ones.
resolver := &dnscache.Resolver{}
// First call will cache the result
addrs, err := resolver.LookupHost(context.Background(), "example.com")
// Subsequent calls will use the cached result
addrs, err = resolver.LookupHost(context.Background(), "example.com")
// Call to refresh will refresh names in cache. If you pass true, it will also
// remove cached names not looked up since the last call to Refresh. It is a good idea
// to call this method on a regular interval.
go func() {
t := time.NewTicker(5 * time.Minute)
defer t.Stop()
for range t.C {
resolver.Refresh(true)
}
}()
If you are using an http.Transport
, you can use this cache by specifying a DialContext
function:
r := &dnscache.Resolver{}
t := &http.Transport{
DialContext: func(ctx context.Context, network string, addr string) (conn net.Conn, err error) {
host, port, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
ips, err := r.LookupHost(ctx, host)
if err != nil {
return nil, err
}
for _, ip := range ips {
var dialer net.Dialer
conn, err = dialer.DialContext(ctx, network, net.JoinHostPort(ip, port))
if err == nil {
break
}
}
return
},
}
If addition to the Refresh
method, you can RefreshWithOptions
. This method adds an option to persist resource records
on failed lookups
r := &Resolver{}
options := dnscache.ResolverRefreshOptions{}
options.ClearUnused = true
options.PersistOnFailure = false
resolver.RefreshWithOptions(options)
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].