Skip to content

Commit

Permalink
running in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
wyhaya committed Sep 1, 2018
1 parent 4f1bac8 commit 4fb62c6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ updns is a DNS server developed using node, only need a simple configuration to
## Running as a Service

```
npm install -g updns
yarn global add updns
```

#### Config
### Config

We configure routing in the way of hosts

Expand All @@ -29,15 +29,31 @@ proxy 8.8.8.8 # proxy => DNS Server
google.com 1.1.1.1 # domain => IP
/goo+gle\.com/ 2.2.2.2 # regex: gooooooooooogle.com => IP
```
#### Start to use

### Start to use
```
updns start
```
You may use `sudo` to run this command because you will use the `53` port, make sure you have sufficient permissions.

Now change your local DNS server to `127.0.0.1` 🚀

#### Other
### Running in docker

Create and run a container with `docker-compose`

```
docker-compose up -d
```

```
docker attach updns
cd /root
./bin/updns start
```


### Other

| Command | Explain |
| ------------- | ------------- |
Expand All @@ -53,11 +69,12 @@ Now change your local DNS server to `127.0.0.1` 🚀
## Create DNS Server
You can also create your DNS server as a module
```
npm install updns
yarn add updns
```
If an IP address is not specified, the port will be bound globally (0.0.0.0)

```javascript
const updns = require('updns').createServer(53, '127.0.0.1')
// If an IP address is not specified, the port will be bound globally (0.0.0.0)

updns.on('error', error => {
console.log(error)
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@


version: "3.3"

services:

dns:
container_name: updns
restart: always
image: node
stdin_open: true
tty: true
privileged: true
ports:
- 53:53/udp
volumes:
- ./:/root/
command: /bin/bash


0 comments on commit 4fb62c6

Please sign in to comment.