mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-26 23:28:08 +03:00
Merge pull request #80 in DNS/adguard-dns from rename to master
* commit '1af11c4e45e13bcbeb9fe37f7867760f09ae8c2b': Name migration -- rename config from AdguardDNS.yaml to AdGuardHome.yaml Rename from 'Adguard DNS' to 'AdGuard Home'.
This commit is contained in:
commit
96142b4164
14 changed files with 83 additions and 46 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,8 +1,8 @@
|
|||
.DS_Store
|
||||
.vscode
|
||||
debug
|
||||
/AdguardDNS
|
||||
/AdguardDNS.yaml
|
||||
/AdGuardHome
|
||||
/AdGuardHome.yaml
|
||||
/build/
|
||||
/client/node_modules/
|
||||
/coredns
|
||||
|
|
6
Makefile
6
Makefile
|
@ -7,7 +7,7 @@ GOPATH := $(mkfile_dir)/build/gopath
|
|||
JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js')
|
||||
STATIC = build/static/index.html
|
||||
|
||||
TARGET=AdguardDNS
|
||||
TARGET=AdGuardHome
|
||||
|
||||
.PHONY: all build clean
|
||||
all: build
|
||||
|
@ -23,10 +23,10 @@ $(STATIC): $(JSFILES) client/node_modules
|
|||
|
||||
$(TARGET): $(STATIC) *.go coredns_plugin/*.go dnsfilter/*.go
|
||||
mkdir -p $(GOPATH)/src/github.com/AdguardTeam
|
||||
if [ ! -h $(GOPATH)/src/github.com/AdguardTeam/AdguardDNS ]; then rm -rf $(GOPATH)/src/github.com/AdguardTeam/AdguardDNS && ln -fs ../../../../.. $(GOPATH)/src/github.com/AdguardTeam/AdguardDNS; fi
|
||||
if [ ! -h $(GOPATH)/src/github.com/AdguardTeam/AdGuardHome ]; then rm -rf $(GOPATH)/src/github.com/AdguardTeam/AdGuardHome && ln -fs ../../../../.. $(GOPATH)/src/github.com/AdguardTeam/AdGuardHome; fi
|
||||
GOPATH=$(GOPATH) go get -v -d .
|
||||
GOPATH=$(GOPATH) GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) go get -v github.com/gobuffalo/packr/...
|
||||
mkdir -p $(GOPATH)/src/github.com/AdguardTeam/AdguardDNS/build/static ## work around packr bug
|
||||
mkdir -p $(GOPATH)/src/github.com/AdguardTeam/AdGuardHome/build/static ## work around packr bug
|
||||
cd $(GOPATH)/src/github.com/prometheus/client_golang && git reset --hard v0.8.0
|
||||
perl -0777 -p -i.bak -e 's/pprofOnce.Do\(func\(\) {(.*)}\)/\1/ms' $(GOPATH)/src/github.com/coredns/coredns/plugin/pprof/setup.go
|
||||
perl -0777 -p -i.bak -e 's/c.OnShutdown/c.OnRestart/' $(GOPATH)/src/github.com/coredns/coredns/plugin/pprof/setup.go
|
||||
|
|
38
README.md
38
README.md
|
@ -1,16 +1,16 @@
|
|||
[![Build Status](https://travis-ci.org/AdguardTeam/AdguardDNS.svg)](https://travis-ci.org/AdguardTeam/AdguardDNS)
|
||||
[![Build Status](https://travis-ci.org/AdguardTeam/AdGuardHome.svg)](https://travis-ci.org/AdguardTeam/AdGuardHome)
|
||||
|
||||
# Self-hosted AdGuard DNS
|
||||
# AdGuard Home
|
||||
|
||||
AdGuard DNS is an alternative way to block ads, trackers and phishing websites, and also a parental control instrument.
|
||||
AdGuard Home is an alternative way to block ads, trackers and phishing websites, and also a parental control instrument.
|
||||
|
||||
## How does AdGuard DNS work?
|
||||
## How does AdGuard Home work?
|
||||
|
||||
If you configure your network to use this DNS server, every time a website sends an ad or phishing request, our server sends back a null ("empty") response. AdGuard has a database of domain names that serve for an ad, tracking or phishing purposes (and adult content, in case of parental control mode), and this database is regularly updated.
|
||||
It works as a DNS server, if you configure your network to use this DNS server, every time a website sends an ad or phishing request, our server sends back a null ("empty") response. AdGuard has a database of domain names that serve for an ad, tracking or phishing purposes (and adult content, in case of parental control mode), and this database is regularly updated.
|
||||
|
||||
## How is this different from public AdGuard DNS servers?
|
||||
|
||||
Running your own AdGuard DNS offers you more options:
|
||||
Running your own AdGuard Home offers you more options:
|
||||
* Enable/disable ad blocking on the fly.
|
||||
* Enable/disable blocking of phishing and malware websites.
|
||||
* Enable/disable blocking of websites with adult content.
|
||||
|
@ -18,7 +18,7 @@ Running your own AdGuard DNS offers you more options:
|
|||
* See DNS query log — it shows what requests were sent by which clients and why a request was blocked.
|
||||
* Add your own custom filtering rules.
|
||||
|
||||
This repository describes how to set up and run your self-hosted instance of AdGuard DNS — it comes with a web dashboard that can be accessed via browser to control the DNS server and change its settings, it also allows to add your own filters written in both "hosts" and AdGuard syntaxes.
|
||||
This repository describes how to set up and run your self-hosted instance of AdGuard Home — it comes with a web dashboard that can be accessed via browser to control the DNS server and change its settings, it also allows to add your own filters written in both "hosts" and AdGuard syntaxes.
|
||||
|
||||
If this seems too complicated, you can always use our public AdGuard DNS servers — they are running the same code as in this repository and provide the same ad blocking/phishing protection/parental control functionality — https://adguard.com/en/adguard-dns/overview.html
|
||||
|
||||
|
@ -26,33 +26,33 @@ If this seems too complicated, you can always use our public AdGuard DNS servers
|
|||
|
||||
### Mac
|
||||
|
||||
Download this file: [AdguardDNS_0.1_MacOS.zip](https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_MacOS.zip), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
Download this file: [AdGuardHome_0.1_MacOS.zip](https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdGuardHome_0.1_MacOS.zip), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
|
||||
### Linux 64-bit Intel
|
||||
|
||||
Download this file: [AdguardDNS_0.1_linux_amd64.tar.gz](https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_amd64.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
Download this file: [AdGuardHome_0.1_linux_amd64.tar.gz](https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdGuardHome_0.1_linux_amd64.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
|
||||
### Linux 32-bit Intel
|
||||
|
||||
Download this file: [AdguardDNS_0.1_linux_386.tar.gz](https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_386.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
Download this file: [AdGuardHome_0.1_linux_386.tar.gz](https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdGuardHome_0.1_linux_386.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
|
||||
### Raspberry Pi (32-bit ARM)
|
||||
|
||||
Download this file: [AdguardDNS_0.1_linux_arm.tar.gz](https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_arm.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
Download this file: [AdGuardHome_0.1_linux_arm.tar.gz](https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdGuardHome_0.1_linux_arm.tar.gz), then unpack it and follow ["How to run"](#how-to-run) instructions below.
|
||||
|
||||
## How to run
|
||||
|
||||
DNS works on port 53, which requires superuser privileges. Therefore, you need to run it with `sudo` in terminal:
|
||||
|
||||
```bash
|
||||
sudo ./AdguardDNS
|
||||
sudo ./AdGuardHome
|
||||
```
|
||||
|
||||
Now open the browser and navigate to http://localhost:3000/ to control your AdGuard DNS server.
|
||||
Now open the browser and navigate to http://localhost:3000/ to control your AdGuard Home service.
|
||||
|
||||
### Running without superuser
|
||||
|
||||
You can run AdGuard DNS without superuser privileges, but you need to instruct it to use a different port rather than 53. You can do that by editing `AdguardDNS.yaml` and finding these two lines:
|
||||
You can run AdGuard Home without superuser privileges, but you need to instruct it to use a different port rather than 53. You can do that by editing `AdGuardHome.yaml` and finding these two lines:
|
||||
|
||||
```yaml
|
||||
coredns:
|
||||
|
@ -65,7 +65,7 @@ If the file does not exist, create it in the same folder, type these two lines d
|
|||
|
||||
### Additional configuration
|
||||
|
||||
Upon the first execution, a file named `AdguardDNS.yaml` will be created, with default values written in it. You can modify the file while your AdGuard DNS is not running. Otherwise, any changes to the file will be lost because the running program will overwrite them.
|
||||
Upon the first execution, a file named `AdGuardHome.yaml` will be created, with default values written in it. You can modify the file while your AdGuard Home service is not running. Otherwise, any changes to the file will be lost because the running program will overwrite them.
|
||||
|
||||
Settings are stored in [YAML format](https://en.wikipedia.org/wiki/YAML), possible parameters that you can configure are listed below:
|
||||
|
||||
|
@ -109,15 +109,15 @@ brew install go node
|
|||
Open Terminal and execute these commands:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/AdguardTeam/AdguardDNS
|
||||
cd AdguardDNS
|
||||
git clone https://github.com/AdguardTeam/AdGuardHome
|
||||
cd AdGuardHome
|
||||
make
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
You are welcome to fork this repository, make your changes and submit a pull request — https://github.com/AdguardTeam/AdguardDNS/pulls
|
||||
You are welcome to fork this repository, make your changes and submit a pull request — https://github.com/AdguardTeam/AdGuardHome/pulls
|
||||
|
||||
## Reporting issues
|
||||
|
||||
If you run into any problem or have a suggestion, head to [this page](https://github.com/AdguardTeam/AdguardDNS/issues) and click on the `New issue` button.
|
||||
If you run into any problem or have a suggestion, head to [this page](https://github.com/AdguardTeam/AdGuardHome/issues) and click on the `New issue` button.
|
||||
|
|
37
app.go
37
app.go
|
@ -28,6 +28,8 @@ func main() {
|
|||
config.ourBinaryDir = filepath.Dir(executable)
|
||||
}
|
||||
|
||||
doConfigRename := true
|
||||
|
||||
// config can be specified, which reads options from there, but other command line flags have to override config values
|
||||
// therefore, we must do it manually instead of using a lib
|
||||
{
|
||||
|
@ -96,9 +98,18 @@ func main() {
|
|||
}
|
||||
}
|
||||
if configFilename != nil {
|
||||
// config was manually specified, don't do anything
|
||||
doConfigRename = false
|
||||
config.ourConfigFilename = *configFilename
|
||||
}
|
||||
|
||||
if doConfigRename {
|
||||
err := renameOldConfigIfNeccessary()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
err := askUsernamePasswordIfPossible()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -229,3 +240,29 @@ func askUsernamePasswordIfPossible() error {
|
|||
config.AuthPass = password
|
||||
return nil
|
||||
}
|
||||
|
||||
func renameOldConfigIfNeccessary() error {
|
||||
oldConfigFile := filepath.Join(config.ourBinaryDir, "AdguardDNS.yaml")
|
||||
_, err := os.Stat(oldConfigFile)
|
||||
if os.IsNotExist(err) {
|
||||
// do nothing, file doesn't exist
|
||||
trace("File %s doesn't exist, nothing to do", oldConfigFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
newConfigFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
|
||||
_, err = os.Stat(newConfigFile)
|
||||
if !os.IsNotExist(err) {
|
||||
// do nothing, file doesn't exist
|
||||
trace("File %s already exists, will not overwrite", newConfigFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
err = os.Rename(oldConfigFile, newConfigFile)
|
||||
if err != nil {
|
||||
log.Printf("Failed to rename %s to %s: %s", oldConfigFile, newConfigFile, err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class Upstream extends Component {
|
|||
return (
|
||||
<Card
|
||||
title="Upstream DNS servers"
|
||||
subtitle="If you keep this field empty, AdGuard will use <a href='https://1.1.1.1/' target='_blank'>Cloudflare DNS</a> as an upstream. Use tls:// prefix for DNS over TLS servers."
|
||||
subtitle="If you keep this field empty, AdGuard Home will use <a href='https://1.1.1.1/' target='_blank'>Cloudflare DNS</a> as an upstream. Use tls:// prefix for DNS over TLS servers."
|
||||
bodyType="card-body box-body--settings"
|
||||
>
|
||||
<div className="row">
|
||||
|
|
|
@ -17,6 +17,6 @@ export const STATUS_COLORS = {
|
|||
};
|
||||
|
||||
export const REPOSITORY = {
|
||||
URL: 'https://github.com/AdguardTeam/AdguardDNS',
|
||||
TRACKERS_DB: 'https://github.com/AdguardTeam/AdguardDNS/tree/master/client/src/helpers/trackers/adguard.json',
|
||||
URL: 'https://github.com/AdguardTeam/AdGuardHome',
|
||||
TRACKERS_DB: 'https://github.com/AdguardTeam/AdGuardHome/tree/master/client/src/helpers/trackers/adguard.json',
|
||||
};
|
||||
|
|
|
@ -62,7 +62,7 @@ var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
|
|||
|
||||
// initialize to default values, will be changed later when reading config or parsing command line
|
||||
var config = configuration{
|
||||
ourConfigFilename: "AdguardDNS.yaml",
|
||||
ourConfigFilename: "AdGuardHome.yaml",
|
||||
BindPort: 3000,
|
||||
BindHost: "127.0.0.1",
|
||||
CoreDNS: coreDNSConfig{
|
||||
|
|
|
@ -15,8 +15,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
coredns_plugin "github.com/AdguardTeam/AdguardDNS/coredns_plugin"
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
coredns_plugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"github.com/miekg/dns"
|
||||
"gopkg.in/asaskevich/govalidator.v4"
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
|
|||
var versionCheckJSON []byte
|
||||
var versionCheckLastTime time.Time
|
||||
|
||||
const versionCheckURL = "https://adguardteam.github.io/AdguardDNS/version.json"
|
||||
const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json"
|
||||
const versionCheckPeriod = time.Hour * 8
|
||||
|
||||
var client = &http.Client{
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync"
|
||||
|
||||
// Include all plugins.
|
||||
_ "github.com/AdguardTeam/AdguardDNS/coredns_plugin"
|
||||
_ "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
|
||||
_ "github.com/coredns/coredns/plugin/auto"
|
||||
_ "github.com/coredns/coredns/plugin/autopath"
|
||||
_ "github.com/coredns/coredns/plugin/bind"
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
"github.com/coredns/coredns/plugin/metrics"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"github.com/coredns/coredns/plugin/pkg/response"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"github.com/bluele/gcache"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# AdGuard DNS Go library
|
||||
# AdGuard Home's DNS filtering go library
|
||||
|
||||
Example use:
|
||||
```bash
|
||||
[ -z "$GOPATH" ] && export GOPATH=$HOME/go
|
||||
go get -d github.com/AdguardTeam/AdguardDNS/dnsfilter
|
||||
go get -d github.com/AdguardTeam/AdGuardHome/dnsfilter
|
||||
```
|
||||
|
||||
Create file filter.go
|
||||
|
@ -11,7 +11,7 @@ Create file filter.go
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
@ -48,7 +48,7 @@ You can also enable checking against AdGuard's SafeBrowsing:
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/AdguardTeam/AdguardDNS/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
|
14
version.json
14
version.json
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"version": "v0.1",
|
||||
"announcement": "AdGuard DNS v0.1 is now available!",
|
||||
"announcement_url": "https://github.com/AdguardTeam/AdguardDNS/releases/tag/v0.1",
|
||||
"download_darwin_amd64": "https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_MacOS.zip",
|
||||
"download_linux_amd64": "https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_amd64.tar.gz",
|
||||
"download_linux_386": "https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_386.tar.gz",
|
||||
"download_linux_arm": "https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_arm.tar.gz",
|
||||
"download_linux_arm64": "https://github.com/AdguardTeam/AdguardDNS/releases/download/v0.1/AdguardDNS_0.1_linux_arm64.tar.gz",
|
||||
"announcement": "AdGuard Home v0.1 is now available!",
|
||||
"announcement_url": "https://github.com/AdguardTeam/AdGuardHome/releases/tag/v0.1",
|
||||
"download_darwin_amd64": "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdguardDNS_0.1_MacOS.zip",
|
||||
"download_linux_amd64": "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdguardDNS_0.1_linux_amd64.tar.gz",
|
||||
"download_linux_386": "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdguardDNS_0.1_linux_386.tar.gz",
|
||||
"download_linux_arm": "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdguardDNS_0.1_linux_arm.tar.gz",
|
||||
"download_linux_arm64": "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.1/AdguardDNS_0.1_linux_arm64.tar.gz",
|
||||
"selfupdate_min_version": "v0.0"
|
||||
}
|
Loading…
Reference in a new issue