TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: godns A DNS forwarder similar to dnsmasq

5 点作者 nodesocket大约 1 个月前
godns is a super basic DNS server in go (mostly fun and go practice) which allows you to specify hosts and ips in a json config file. This eliminates the need for editing your local &#x2F;etc&#x2F;hosts file. If it matches a host in the json config file it returns that ip, else uses Cloudflare public DNS resolver as a fallback.<p>Please; easy on my go code :-). I am a total beginner with go. PRs welcome.

1 comment

goku12大约 1 个月前
I haven&#x27;t spent the time to learn Go yet. My main language is Rust and I&#x27;m currently learning Zig. So I have few code recommendations at the moment. However, I do have a few generic suggestions based on what you&#x27;ve conveyed here. They&#x27;re not criticisms by any means.<p>1. DNS means a lot of things in reality. It can be an authoritative name server, a caching resolver, a recursive resolver, any combination of those and then some. While you mentioned the type for godns here, it&#x27;s missing in the readme. Without that information there, it&#x27;s hard for a visitor to decide at a glance if it&#x27;s something they&#x27;re interested in. I suggest that the first sentence in a readme be one that conveys the technical purpose of the project in as few words as possible.<p>2. While not a popular opinion, naming the project after its programming language might seem unimaginative or like language zealotry - even if the author didn&#x27;t intend it. Sometimes it even leads to confusion. For example, it won&#x27;t be surprising if people think that goreleaser is a dev tool for the go language alone (which it was initially), though it supports more languages now. In your case, I was wondering what &#x27;god ns&#x27; means! Try an imaginative name that projects the personality of your project. It&#x27;s fine to mention the language afterwards (ProjectK made with Go). (This applies to all languages including Rust).<p>3. Editing &#x2F;etc&#x2F;hosts is not hard by any means. So it&#x27;s questionable what another resolver is going to add. However, one thing I find difficult with hosts file is adding wildcard domains. I had to use dnsmasq for this. Dnsmasq is also an overkill for such use cases. You should consider that feature. Better yet, regex domains perhaps? Another idea is to have a simple API that could be served through a unix socket. That way, regular users with permission can quickly add records programmatically or using a CLI client. Perhaps there can also be an API call to discard or persist the changes (like how firewalld does it) without root permissions. This would be very useful for local web app development along with a tool like mkcert.<p>4. The choice to use the cloudfare resolver is reasonable. But not everyone may like it, due to privacy concerns. There should probably be a way to specify something else - perhaps from DHCP too.<p>5. It looks like you are serving A records. That is a very reasonable default with sufficient use cases. But other options like TXT records are not usually available for temporary local uses, unless you setup a full blown authoritative server. That would be a useful addition too.<p>That&#x27;s it for now. Feel free to utilize these suggestions however you like. Good luck with this and your future Go projects!
评论 #43653191 未加载