{"id":15323748,"url":"https://github.com/mvrilo/godns","last_synced_at":"2025-10-09T10:31:35.009Z","repository":{"id":12421636,"uuid":"15076287","full_name":"mvrilo/godns","owner":"mvrilo","description":"A fast dns cache server written by go","archived":false,"fork":true,"pushed_at":"2013-12-12T13:08:56.000Z","size":1403,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T19:02:14.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"blog.kenshinx.me","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kenshinx/godns","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvrilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-10T12:16:31.000Z","updated_at":"2014-01-08T15:34:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mvrilo/godns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mvrilo/godns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgodns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgodns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgodns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgodns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvrilo","download_url":"https://codeload.github.com/mvrilo/godns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Fgodns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001275,"owners_count":26083040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T09:21:36.465Z","updated_at":"2025-10-09T10:31:33.909Z","avatar_url":"https://github.com/mvrilo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"GODNS\n====\n\nA simple and fast dns cache server written by go.\n\n\nSimilar as [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) ,but support some difference features:\n\n\n* Keep hosts records in redis instead of the local file /etc/hosts  \n\n* Atuo-Reload when hosts configuration changed. (Yes,dnsmasq need restart)\n\n* Cache records save in memory or redis configurable\n\n\n## Install \u0026 Running\n\n1. Install  \n\n\t\t$ go get github.com/kenshinx/godns\n\n\n2. Build  \n\n\t\t$ cd $GOPATH/src/github.com/kenshinx/godns \n\t\t$ go build -o godns *.go\n\n\n3. Running  \n\n\t\t$ sudo ./godns -c godns.conf\n\n\n4. Use\n\n\t\t$ sudo vi /etc/resolv.conf\n\t\tnameserver 127.0.0.1\n\n\n\n## Configuration\n\nAll the configuration on `godns.conf` a TOML formating config file.   \nMore about Toml :[https://github.com/mojombo/toml](https://github.com/mojombo/toml)\n\n\n#### resolv.conf\n\nUpstream server can be configuration by change file from somewhere other that \"/etc/resolv.conf\"\n\n```\n[resolv]\nresolv-file = \"/etc/resolv.conf\"\n```\nIf multi `namerserver` set at resolv.conf, the upsteam server will try in order of up to botton\n\n\n\n#### cache\n\nOnly the local memory storage backend implemented now.  The redis backend is in todo list\n\n```\n[cache]\nbackend = \"memory\"   \nexpire = 600  # default expire time 10 minutes\nmaxcount = 100000\n```\n\n\n\n#### hosts\n\nForce resolv domain to assigned ip, support two types hosts configuration:\n\n* locale hosts file\n* remote redis hosts\n\n__hosts file__  \n\ncan be assigned at godns.conf,default : `/etc/hosts`\n\n```\n[hosts]\nhost-file = \"/etc/hosts\"\n```\n\n\n__redis hosts__ \n\nThis is a espeical requirment in our system. Must maintain a gloab hosts configuration, \nand support update the hosts record from other remote server.\nso \"redis-hosts\" is be supported, and will query the reids when each dns request reached.  \n\nThe hosts record is organized with redis hash map. and the key of the map is configured.\n\n```\n[hosts]\nredis-key = \"godns:hosts\"\n```\n\n_Insert hosts records into redis_\n\n```\nredis \u003e hset godns:hosts www.sina.com.cn 1.1.1.1\n```\n\n\n\n## Benchmak\n\n\n__Debug close__\n\n```\n$ go test -bench=.\n\ntesting: warning: no tests to run\nPASS\nBenchmarkDig-8     50000             57945 ns/op\nok      _/usr/home/keqiang/godns        3.259s\n```\n\nThe result : 15342 queries/per second\n\nThe enviroment of test:\n\nCentOS release 6.4 \n\n* CPU:  \nIntel Xeon 2.40GHZ \n4 cores\n\n* MEM:  \n46G\n\n\n## Web console\n\nJoke: A web console for godns\n\n[https://github.com/kenshinx/joke](https://github.com/kenshinx/joke) \n\nscreenshot\n\n![joke](https://raw.github.com/kenshinx/joke/master/screenshot/joke.png)\n\n\n\n## Deployment\n\nDeployment in productive supervisord highly recommended.\n\n```\n\n[program:godns]\ncommand=/usr/local/bin/godns -c /etc/godns.conf\nautostart=true\nautorestart=true\nuser=root\nstdout_logfile_maxbytes = 50MB\nstdoiut_logfile_backups = 20\nstdout_logfile = /var/log/godns.log\n\n```\n\n\n## TODO\n\n* The redis cache backend\n* Update ttl\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Fgodns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvrilo%2Fgodns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Fgodns/lists"}