https://github.com/vkuznet/dcr
DNS Cache Resolver
https://github.com/vkuznet/dcr
Last synced: about 1 month ago
JSON representation
DNS Cache Resolver
- Host: GitHub
- URL: https://github.com/vkuznet/dcr
- Owner: vkuznet
- License: mit
- Created: 2020-09-22T12:44:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-05T12:26:58.000Z (about 3 years ago)
- Last Synced: 2025-02-10T01:41:30.580Z (3 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### DNS Cache Resolver (dcr)
[](https://travis-ci.org/vkuznet/dcr)
[](https://goreportcard.com/report/github.com/vkuznet/dcr)
[](https://godoc.org/github.com/vkuznet/dcr)dcr is a simple library to resolve and cache URLs from hostbased naming
convention to IP based one. For instance, if you have an URL like
`http://www.google.com` and would like to resolve it into IP based URL
this library will help you, e.g.```
// set DNSManager
var mgr DNSManager
host := "www.google.com"
rurl := fmt.Sprintf("http://%s/", host)// resolve given URL
ipUrl := mgr.Resolve(rurl)// print existing cache content
fmt.Println(mgr.String()){"http://www.google.com/":["http://172.217.6.228/","http://[2607:f8b0:4006:802::2004]/"]}
```### Use-cases
In service like applications where code needs to deal with lots of
similart URLs it is handy to define local cache of their IP representations
without going through DNS server. For example, in web server where you need
to handle multiple URLs at high rate and all of those URLs have a small
set of unique hostnames, it is beneficial to resolve and cache theose URLs
to avoid flood of requests to DNS server