{"id":15373028,"url":"https://github.com/vi/dnscache","last_synced_at":"2025-04-15T12:31:26.320Z","repository":{"id":57620380,"uuid":"114492543","full_name":"vi/dnscache","owner":"vi","description":"Simple DNS proxy with forced caching","archived":false,"fork":false,"pushed_at":"2018-09-04T20:29:48.000Z","size":80,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T21:02:46.433Z","etag":null,"topics":["cache","cbor","dns","dns-cache","dns-proxy","leveldb","pure-rust","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vi.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":"2017-12-16T21:54:50.000Z","updated_at":"2024-10-09T12:41:56.000Z","dependencies_parsed_at":"2022-09-02T17:32:12.840Z","dependency_job_id":null,"html_url":"https://github.com/vi/dnscache","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fdnscache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fdnscache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fdnscache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fdnscache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vi","download_url":"https://codeload.github.com/vi/dnscache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402525,"owners_count":21097331,"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","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":["cache","cbor","dns","dns-cache","dns-proxy","leveldb","pure-rust","rust"],"created_at":"2024-10-01T13:54:07.913Z","updated_at":"2025-04-15T12:31:26.062Z","avatar_url":"https://github.com/vi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Dnscache\n----\n\nSimple DNS proxy supporting one upstream.\nDesigned for using slow and unreliable upstream DNS servers like Tor's DNS resolver.\nTrades consistency for availability. Not for serious use.\n\nLicense = MIT or Apache 2.0\n\nThere are some pre-built versions on Github releases. Versions older than 0.3.1 depend on buggy rusy-leveldb and may sporadically panic.\n\nDNSCache can also be used as a library (with your own database and network abstraction, but with DNS packets still as byte blobs).\n\n---\n\n```\ndnscache 0.1.3\nVitaly _Vi Shukela \u003cvi0oss@gmail.com\u003e\nSimple DNS cacher.\n\nUSAGE:\n    dnscache [OPTIONS] \u003clisten_addr\u003e \u003cupstream_addr\u003e \u003cdb\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nOPTIONS:\n        --max-ttl \u003cmax_ttl\u003e    Maximum TTL of A or AAAA entry, seconds [default: 4294967295]\n        --min-ttl \u003cmin_ttl\u003e    Minimum TTL of A or AAAA entry, seconds [default: 0]\n        --neg-ttl \u003cneg_ttl\u003e    Negative reply TTL, seconds [default: 30]\n\nARGS:\n    \u003clisten_addr\u003e      Listen address and port\n    \u003cupstream_addr\u003e    Upstream DNS server address and port\n    \u003cdb\u003e               Path to LevelDB database directory\n    \n    \n$ dnscache --neg-ttl 7200 127.0.0.1:53 127.0.0.1:6053 db --min-ttl 7200\nA\tusers.rust-lang.org  cached\nAAAA\tusers.rust-lang.org  cached\nA\tgoogle.com  queued\n  upstream\n  saved to database: google.com\n  replied...\nA\twww.google.com  cached, but refreshing\n  upstream\n  refusing to forget A entries\n  saved to database: www.google.com\nA\tgoogle.com  cached, negative 31.\nAAAA\tvi-notebook  cached, negative 6600.\nAAAA\tvi-notebook  cached, negative 6601.\nA\tusers.rust-lang.org  cached\nAAAA\tusers.rust-lang.org  cached\n...\n```\n\n-----\n\nFeatures:\n\n* IPv6 AAAA records\n* Forwarding of trickier queries as is\n* Multi-question queries\n* Minimal protection from poisoning by filtering domain names in replies\n* Always tries to immediately return some A or AAAA records for client to try, no waiting for refreshing.\n* Clamping TTL betwen user-specified min and max (the cache contains unmodified value).\n\nNotes:\n\n* It does not construct DNS requests on its own, it reuses client-constructed packets\n* Uncached queries (non-A, non-AAAA or non-IN) are forwarded based in ID\n* TTL may be 0 in replies\n* Single threaded, single UDP socket\n* If all A or AAAA entries disappear in reply, cached ones retain instead. AAAA resolution sometimes works in Tor DNS resolver, sometimes not.\n* CNAMEs are resolved recursively into A/AAAA entries and are not persisted\n* Unsupported queries (MX, All) are forwarded as-is based on ID only\n* Entire dnscache is case-sensitive. `google.com` and `Google.com` are queried and cached separately.\n\nConcerns:\n\n* Entries are never deleted from cache\n* If data is stale, it first replies with TTL 0, then re-checks in upstream\n* The used LevelDB implementation is not recommended for serious use yet.\n* The same socket used both for client and for upstream communication. Can't listen only on 127.0.0.1, but rely on 8.8.8.8.\n* There are no timeouts or timekeeping. Unreplied requests may stay in memory indefinitely. There may be a lot of `unsolicited reply for ...` log entries because of replies for retries.\n\n---\n\nDatabase format: LevelDB database with domain names like `internals.rust-lang.org` as keys and [CBOR](https://cbor.io) as values. Sample value:\n\n```\n{\"a4\": {\"t\": 1513810855, \"a\": [{\"ttl\": 599, \"ip\": h'4047a8d3'}]}, \"a6\": {\"t\": 1513810855, \"a\": [{\"ttl\": 599, \"ip\": h'20010470000103a80000000000000211'}]}}\n\n00000000  a2 62 61 34 a2 61 74 1a  5a 3a eb a7 61 61 81 a2  |.ba4.at.Z:..aa..|\n00000010  63 74 74 6c 19 02 57 62  69 70 44 40 47 a8 d3 62  |cttl..WbipD@G..b|\n00000020  61 36 a2 61 74 1a 5a 3a  eb a7 61 61 81 a2 63 74  |a6.at.Z:..aa..ct|\n00000030  74 6c 19 02 57 62 69 70  50 20 01 04 70 00 01 03  |tl..WbipP ..p...|\n00000040  a8 00 00 00 00 00 00 02  11                       |.........|\n00000049\n```\n\nSimple description:\n\n```\n{\"a4\": {\"t\": timestamp_unix, \"a\":[IPv4/TTL pairs list]}, \"a6\": null (for never requested values)}\n{\"t\": ..., \"a\":[(empty list)]} means negatively cached\n```\n\nThe format is subject to change and is other than one used by pre-build 1.2 binaries.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Fdnscache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvi%2Fdnscache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Fdnscache/lists"}