-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6cf9c6a
Showing
17 changed files
with
2,133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# external packages folder | ||
vendor/ | ||
|
||
*.db | ||
*.log | ||
dist/ | ||
dogo.json | ||
nogo | ||
TODO.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: go | ||
|
||
go: | ||
- 1.8 | ||
- tip | ||
|
||
matrix: | ||
allow_failures: | ||
- go: tip | ||
fast_finish: true | ||
|
||
install: | ||
- go get github.com/miekg/dns | ||
- go get github.com/boltdb/bolt | ||
- go get github.com/pressly/chi | ||
|
||
script: | ||
- go vet | ||
- go test -race |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Change log | ||
|
||
## [1.0.0-beta.1] - 2017-02-26 | ||
|
||
- Initial public release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (c) 2017 Seth Davis https://curia.solutions/ | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
VERSION := 1.0.0-beta.1 | ||
BINARY := nogo | ||
SHELL := /bin/bash | ||
LDFLAGS := "-X main.version=$(VERSION) -X main.build=`git rev-parse --verify --short HEAD`" | ||
GOX_OSARCH := "darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm64 netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64" | ||
GOX_OUTPUT := "build/$(BINARY)_v$(VERSION)_{{.OS}}_{{.Arch}}/$(BINARY)" | ||
|
||
.DEFAULT_GOAL := $(BINARY) | ||
$(BINARY): | ||
go build -ldflags $(LDFLAGS) -o $(BINARY) | ||
|
||
build: # https://github.com/mitchellh/gox | ||
CGO_ENABLED=0 gox -ldflags $(LDFLAGS) -osarch $(GOX_OSARCH) -output $(GOX_OUTPUT) | ||
# gox doesn't support fine-tuning arm (GOARM defaults to 6), so build linux/arm individually | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags $(LDFLAGS) -o build/$(BINARY)_v$(VERSION)_linux_armv5/$(BINARY) | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -o build/$(BINARY)_v$(VERSION)_linux_armv6/$(BINARY) | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags $(LDFLAGS) -o build/$(BINARY)_v$(VERSION)_linux_armv7/$(BINARY) | ||
|
||
dist: build | ||
@mkdir dist | ||
$(eval BUILDS := $(shell find build/ -type f -printf '%P\n')) | ||
@for f in $(BUILDS); do \ | ||
echo "Archiving $${f%/*}..."; \ | ||
if [[ $$f =~ darwin|windows ]]; then \ | ||
zip -j dist/$${f%/*}.zip build/$$f README.md; \ | ||
else \ | ||
tar -cvzf dist/$${f%/*}.tar.gz README.md -C build/$${f%/*} $${f#*/}; \ | ||
fi; \ | ||
done | ||
|
||
.PHONY: deps | ||
deps: | ||
go get github.com/miekg/dns | ||
go get github.com/boltdb/bolt | ||
go get github.com/pressly/chi | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build/ | ||
rm -rf dist/ | ||
go clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
nogo | ||
==== | ||
|
||
[![Linux Build Status](https://img.shields.io/travis/seedifferently/nogo.svg?style=flat-square&label=linux+build)](https://travis-ci.org/seedifferently/nogo) [![Windows Build Status](https://img.shields.io/appveyor/ci/seedifferently/nogo.svg?style=flat-square&label=windows+build)](https://ci.appveyor.com/project/seedifferently/nogo) | ||
|
||
|
||
What? | ||
----- | ||
|
||
`nogo` blocks access to various sites (ads, tracking, porn, gambling, etc) by | ||
acting as a DNS proxy server with host blacklist support. | ||
|
||
|
||
Why? | ||
---- | ||
|
||
I wanted an open source ad blocker solution that was more universal than a | ||
browser plugin, and: | ||
|
||
* Was easy to utilize with unrooted mobile devices (so that [battery life could | ||
be conserved][1]). | ||
* Had a basic web control panel and API for adding, removing, and "pausing" | ||
hosts. | ||
* Provided straightforward cross-platform support and acceptable performance (so | ||
that I could run it from my Raspberry Pi). | ||
* Could be used as a master host "blacklist" service for network-wide ad | ||
blocking (e.g. by configuring the DNS on my router to point to `nogo`). | ||
|
||
[1]: https://lifehacker.com/ad-blockers-on-mobile-can-reduce-battery-drain-by-up-to-1764344384 | ||
|
||
|
||
How? | ||
---- | ||
|
||
You may simply [download a binary release](https://github.com/seedifferently/nogo/releases) | ||
for your platform, or you can follow the steps below to build from source: | ||
|
||
1. Install [Go](https://golang.org/doc/install) (v1.8 or later is required). | ||
|
||
2. Clone the repo, then `cd` into it. | ||
|
||
3. Install the dependencies by running `make deps`. Or if you don't have `make`: | ||
* `go get github.com/miekg/dns` | ||
* `go get github.com/boltdb/bolt` | ||
* `go get github.com/pressly/chi` | ||
|
||
4. Build the app by running `make`. Or if you don't have `make`: `go build` | ||
|
||
5. Run the app: `sudo ./nogo` | ||
|
||
**Note:** | ||
|
||
* Since `nogo` binds to port `:53` by default, it must be given access to | ||
"privileged" ports (e.g. via `setuid` or `sudo`). | ||
* Run with the `-help` switch for information on additional runtime options | ||
(such as disabling or password protecting the web control panel). | ||
|
||
|
||
### Important post-install steps: | ||
|
||
#### 1. You must add hosts to the blacklist. | ||
|
||
`nogo` doesn't ship with a built-in blacklist, so it won't block any hosts until | ||
you add them. | ||
|
||
There are currently two methods for adding hosts to the blacklist: | ||
|
||
1. Navigate to the web control panel (default: [http://localhost:8080/][1]) and | ||
add a host using the form. | ||
|
||
2. Download a popular hosts list file (e.g. pick one from the list at | ||
[https://github.com/StevenBlack/hosts][2]), and execute `nogo` with the | ||
`-import` switch on its first run. | ||
|
||
|
||
#### 2. You must reconfigure your DNS. | ||
|
||
Your computer/mobile device/etc is probably set up by default to utilize a DNS | ||
server which allows connections to any host. Unless you update your DNS | ||
configuration to point to `nogo` (and *only* to `nogo`), nothing will change. | ||
|
||
For those of you who may be unfamiliar with how to update your DNS | ||
configuration, check out Google's guide for their DNS service here: | ||
[https://developers.google.com/speed/public-dns/docs/using][3] | ||
|
||
You can follow their instructions, but don't forget to substitute their DNS | ||
service IP addresses with the sole IP address of the machine running `nogo`. | ||
|
||
[1]: http://localhost:8080/ | ||
[2]: https://github.com/StevenBlack/hosts | ||
[3]: https://developers.google.com/speed/public-dns/docs/using | ||
|
||
|
||
### Known Issues and Limitations | ||
|
||
* The DNS proxy server utilizes a fairly basic configuration, so advanced | ||
features such as EDNS and DNSSEC are not currently supported. | ||
* Due to the fact that the web control panel utilizes a few modern techniques | ||
(such as [flexbox][1] and the [Fetch API][2]), you may experience some issues | ||
with its interface on non-current browsers. | ||
|
||
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes | ||
[2]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | ||
|
||
|
||
Who? | ||
---- | ||
|
||
My name is Seth and I've been talking to machines in various languages since the | ||
early 90s. If you find this useful and want to say thanks, feel free to | ||
[tweet me][1], [buy me a beer][2], [share some Satoshi][3], or pass | ||
[my resume][4] on to someone you know who is tackling interesting problems with | ||
software. | ||
|
||
[1]: https://twitter.com/seedifferently | ||
[2]: https://paypal.me/seedifferently | ||
[3]: https://coinbase.com/seedifferently | ||
[4]: https://resume.sethdavis.name | ||
|
||
|
||
Copyright (c) 2017 Seth Davis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "{build}" | ||
|
||
os: Windows Server 2012 R2 | ||
|
||
clone_folder: c:\gopath\src\github.com\seedifferently\nogo | ||
|
||
environment: | ||
GOPATH: c:\gopath | ||
|
||
install: | ||
- rmdir c:\go /s /q | ||
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.windows-amd64.zip | ||
- 7z x go1.8.windows-amd64.zip -y -oC:\ > NUL | ||
- go version | ||
- go env | ||
- go get github.com/miekg/dns | ||
- go get github.com/boltdb/bolt | ||
- go get github.com/pressly/chi | ||
- set PATH=%GOPATH%\bin;%PATH% | ||
|
||
build: off | ||
|
||
test_script: | ||
- go vet | ||
- go test -race | ||
|
||
deploy: off |
Oops, something went wrong.