# dnsproxy

> A simple DNS proxy server for Node.js

Latest version **0.0.6** (published 2014-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install dnsproxy
pnpm add dnsproxy
yarn add dnsproxy
bun add dnsproxy
```

Provides the command `dnsproxy`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2014-05-02 |
| First published | 2013-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | zhangyuanwei |
| Maintainers | zhangyuanwei |
| Keywords | node, dns, proxy, dnsmasq |

## Links

- npm: https://www.npmjs.com/package/dnsproxy
- Repository: https://github.com/zhangyuanwei/node-dnsproxy
- Issues: https://github.com/zhangyuanwei/node-dnsproxy/issues
- npm.io page: https://npm.io/package/dnsproxy

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2014-05-02
- 0.0.5 — 2014-04-30
- 0.0.4 — 2014-04-30
- 0.0.2 — 2013-08-29
- 0.0.1 — 2013-08-28

## README

node-dnsproxy
==============

A simple DNS proxy server for Node.js  
一个简单的 Node.js DNS 代理服务器  

## Installation 安装

``` shell
npm install dnsproxy               # install from npm
sudo dnsproxy -a a.com:127.0.0.1 & # start dns proxy server
dig @localhost a.com               # test the server, return 127.0.0.1
```

## Usage 使用

``` text
Usage: dnsproxy [-?hv] [-b address] [-p port] [-c true|false] [-a domain1:ip1 [domain2:ip2 [...]]] [-f filename]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -b address    : set bind address
  -p port       : set bind port(default: 53)
  -c true|false : enable/disable cache
  -a domain:ip  : add one or more DNS recode
  -f filename   : load options from file
```

## Pan-analytic 泛解析
``` shell
sudo dnsproxy -a "*.a.com:127.0.0.1" "*.b.a.com:127.0.0.2" "*:127.0.0.3" &
dig @localhost xx.a.com          # return 127.0.0.1
dig @localhost xx.b.a.com        # return 127.0.0.2
dig @localhost any.other.domain  # return 127.0.0.3
```

## Who am I 我是谁
When "ip" configuration is "localhost", node-dnsproxy returns the requesting host IP address  
当"ip"配置为"localhost"时，node-dnsproxy 返回请求主机的ip地址 
When "ip" configuration is "proxyhost", node-dnsproxy returns the binding IP address of the server 
当"ip"配置为"proxyhost"时，node-dnsproxy 返回服务器绑定的ip地址  
``` shell
# start server on 192.168.1.1
sudo dnsproxy -a who.am.i:localhost who.are.you:proxyhost &

# run on 192.168.1.2
dig @192.168.1.1 who.am.i    # return 192.168.1.2
dig @192.168.1.1 who.are.you # return 192.168.1.1

# run on 192.168.1.3
dig @192.168.1.1 who.am.i   # return 192.168.1.3
dig @192.168.1.1 who.are.you # return 192.168.1.1
```

---
_Source: https://npm.io/package/dnsproxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
