forked from cloudflarearchive/odoh-server-go
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from upstream #2
Open
willscott
wants to merge
68
commits into
upstream
Choose a base branch
from
main
base: upstream
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 42 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
d13cf5c
Add more target tests, add invalid keyID error code
tanyav2 d309f3c
create gitignore
natesales 8101246
simplify cli config with flags
natesales aa1dd21
cleanup unnecessary constants
natesales fdc9664
testing: cleanup error handling and consistency with Go code style
natesales defbc4f
move resolver to CLI flag
natesales 3b4aa6f
ignore PEM files and output binary
natesales 921ef4c
require cert and key flags
natesales efb23da
proxy: handle errors safely
natesales ce46005
target: cleanup and handle errors
natesales daa7c73
Merge branch 'master' into tanya/more-target-tests
natesales 17c6d1b
Merge pull request #1 from emeraldonion/tanya/more-target-tests
natesales b229226
update readme info
natesales f333972
ci: fix tests from fork
natesales 178566a
tests: target test consistency
natesales 3992a08
rename master to main
natesales b34be96
testing: fix resolver slice
natesales 66bb82f
fix error handling
natesales 71c9895
fix incorrect status code in test
natesales f8d8dd3
bump module versions
natesales 3621823
pass verbose flag into targetServer
natesales 89f8fb0
replace verbose bool with logging debug level
natesales cc42f5a
cleanup Makefile
natesales 160d0bb
remove target telemetry
natesales 22eef66
remove app deployment manifests
natesales 8742f7d
remove useless name function
natesales 5c9f8c8
add badges
natesales d23fd69
go mod tidy
natesales 2cf438f
add coverage badge
natesales 89be5e2
add coverage testing
natesales 8fd3117
ci: fix coverage workflow name
natesales 7265c9b
update repo name
natesales a7f5d38
add goreleaser release automation
natesales 241ad26
ci: get gopherbadger
natesales f03650d
add optional TLS
natesales cca6f25
ci: update coverage
natesales 400fea9
ci: set coverage bot account
natesales 5f93dad
Merge remote-tracking branch 'origin/main' into main
natesales c9d09cc
set default target DNS resolver to localhost
natesales 149830d
add usage info
natesales a8fae92
add in flight debug logs
natesales fa5fa14
ci: update coverage
github-actions[bot] 9606a68
update package license
natesales d6481d1
Merge remote-tracking branch 'origin/main' into main
natesales 5e1a4dc
add target and proxy timeouts
natesales e76c210
ci: update coverage
github-actions[bot] 4f4ccc5
fix homepage URL
natesales 15949d4
Merge remote-tracking branch 'origin/main' into main
natesales d999871
add target timeout test
natesales 2523041
ci: update coverage
github-actions[bot] f9c028d
add main unit tests
natesales ecda2a8
Merge remote-tracking branch 'origin/main'
natesales 53a7f3f
ci: update coverage
github-actions[bot] 7210175
ignore cover.out
natesales 034946a
Merge branch 'main' of https://github.com/emeraldonion/odoh-server-go
natesales 817b60d
feat: add TLS server test
natesales 6947aea
feat: add prometheus metrics
natesales 2d2a588
feat: add prometheus metrics
natesales c19f7d6
refactor: remove extra ci workflow
natesales 28b14bf
fix: generate self signed cert before test
natesales 2647235
feat: add version flag
natesales c633101
ci: update coverage
github-actions[bot] f1a7743
bump to go 1.17 and update deps
natesales 952e8b0
refactor: defer proxy response error handler
natesales ee6beb2
feat: add docker build
natesales d5fbba6
ci: update coverage
github-actions[bot] 37ffe04
chore: bump dependencies
natesales d9989f6
refactor: remove ioutil and unused test code
natesales File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,38 @@ | ||
name: Run coverage testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "*.go" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.14 | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Get gopherbadger | ||
run: go get github.com/jpoles1/gopherbadger | ||
|
||
- name: Run test | ||
run: gopherbadger -style=for-the-badge -covercmd "go test -v -race -covermode atomic -coverprofile=coverage.out ./... && go tool cover -func=coverage.out" | ||
|
||
- name: Commit coverage badge | ||
uses: EndBug/add-and-commit@v7 | ||
with: | ||
message: "ci: update coverage" | ||
add: "coverage_badge.png" | ||
author_name: "github-actions[bot]" | ||
author_email: "github-actions[bot]@users.noreply.github.com" |
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,26 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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,4 @@ | ||
.idea | ||
*.pem | ||
odohd | ||
dist/ |
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,26 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
builds: | ||
- | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- freebsd | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
nfpms: | ||
- id: odohd | ||
package_name: odohd | ||
vendor: Emerald Onion | ||
homepage: https://packetframe.com | ||
maintainer: Nate Sales <[email protected]> | ||
description: Oblivious DNS over HTTPS server | ||
license: GNU GPL-3.0 | ||
section: utils | ||
priority: extra | ||
formats: | ||
- deb | ||
- rpm |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,95 +1,28 @@ | ||
# odoh-server-go | ||
# odohd | ||
|
||
[![Coverage Status](https://coveralls.io/repos/github/cloudflare/odoh-server-go/badge.svg?branch=master)](https://coveralls.io/github/cloudflare/odoh-server-go?branch=master) | ||
[Oblivious DoH Server](https://tools.ietf.org/html/draft-pauly-dprive-oblivious-doh) based on [Cloudflare's odoh-server-go](https://github.com/cloudflare/odoh-server-go) | ||
|
||
[Oblivious DoH Server](https://tools.ietf.org/html/draft-pauly-dprive-oblivious-doh) | ||
![Coverage Badge](coverage_badge.png) | ||
[![Go Report](https://goreportcard.com/badge/github.com/emeraldonion/odohd?style=for-the-badge)](https://goreportcard.com/report/github.com/emeraldonion/odohd) | ||
[![License](https://img.shields.io/github/license/emeraldonion/odohd?style=for-the-badge)](https://raw.githubusercontent.com/emeraldonion/odohd/main/LICENSE) | ||
[![Release](https://img.shields.io/github/v/release/emeraldonion/odohd?style=for-the-badge)](https://github.com/emeraldonion/odohd/releases) | ||
|
||
# Preconfigured Deployments | ||
This fork includes changes for a server suited to Emerald Onion's production deployment. | ||
|
||
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) | ||
[![deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy) | ||
|
||
# Local development | ||
|
||
To deploy the server locally, first acquire a TLS certificate using [mkcert](https://github.com/FiloSottile/mkcert) as follows: | ||
|
||
~~~ | ||
$ mkcert -key-file key.pem -cert-file cert.pem 127.0.0.1 localhost | ||
~~~ | ||
|
||
Then build and run the server as follows: | ||
|
||
~~~ | ||
$ make all | ||
$ CERT=cert.pem KEY=key.pem PORT=4567 ./odoh-server | ||
~~~ | ||
|
||
You may then run the [corresponding client](https://github.com/cloudflare/odoh-client-go) as follows: | ||
|
||
~~~ | ||
$ ./odoh-client odoh --proxy localhost:4567 --target odoh.cloudflare-dns.com --domain cloudflare.com | ||
;; opcode: QUERY, status: NOERROR, id: 14306 | ||
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 | ||
|
||
;; QUESTION SECTION: | ||
;cloudflare.com. IN AAAA | ||
|
||
;; ANSWER SECTION: | ||
cloudflare.com. 271 IN AAAA 2606:4700::6810:84e5 | ||
cloudflare.com. 271 IN AAAA 2606:4700::6810:85e5 | ||
~~~ | ||
|
||
# Usage | ||
|
||
To deploy, run: | ||
|
||
~~~ | ||
$ gcloud app deploy proxy.yaml | ||
... | ||
$ gcloud app deploy target.yaml | ||
... | ||
~~~ | ||
|
||
To check on its status, run: | ||
|
||
~~~ | ||
$ gcloud app browse | ||
~~~ | ||
|
||
To stream logs when deployed, run | ||
|
||
~~~ | ||
$ gcloud app logs tail -s default | ||
~~~ | ||
|
||
To run locally build and run the project using | ||
|
||
```shell | ||
go build | ||
PORT=8080 ./odoh-server-go | ||
``` | ||
|
||
By default, the proxy listens on `/proxy` and the target listens on `/dns-query`. | ||
|
||
## Reverse proxy | ||
|
||
You need to deploy a reverse proxy with a valid TLS server certificate | ||
for clients to be able to authenticate the target or proxy. | ||
|
||
The simplest option for this is using [Caddy](https://caddyserver.com). | ||
Caddy will automatically provision a TLS certificate using ACME from [Let's Encrypt](https://letsencrypt.org). | ||
|
||
For instance: | ||
## Usage: | ||
|
||
``` | ||
caddy reverse-proxy --from https://odoh.example.net:443 --to 127.0.0.1:8080 | ||
``` | ||
|
||
Alternatively, use a Caddyfile similar to: | ||
|
||
``` | ||
odoh.example.net | ||
|
||
reverse_proxy localhost:8080 | ||
Usage: | ||
odohd [OPTIONS] | ||
|
||
Application Options: | ||
-l, --listen= Address to listen on (default: localhost:8080) | ||
-r, --resolver= Target DNS resolver to query (default: 127.0.0.1:53) | ||
-t, --no-tls Disable TLS | ||
-c, --cert= TLS certificate file | ||
-k, --key= TLS key file | ||
-v, --verbose Enable verbose logging | ||
|
||
Help Options: | ||
-h, --help Show this help message | ||
``` | ||
and run `caddy start`. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
module github.com/cloudflare/odoh-server-go | ||
module github.com/emeraldonion/odohd | ||
|
||
go 1.14 | ||
go 1.16 | ||
|
||
require ( | ||
cloud.google.com/go/logging v1.1.1 | ||
github.com/cisco/go-hpke v0.0.0-20201215202025-9cebdf8f33d4 | ||
github.com/cloudflare/odoh-go v0.1.4 | ||
github.com/elastic/go-elasticsearch/v8 v8.0.0-20201022194115-1af099fb3eca | ||
github.com/miekg/dns v1.1.35 | ||
github.com/cisco/go-hpke v0.0.0-20210215210317-01c430f1f302 | ||
github.com/cloudflare/odoh-go v0.1.6 | ||
github.com/jessevdk/go-flags v1.5.0 | ||
github.com/miekg/dns v1.1.41 | ||
github.com/sirupsen/logrus v1.8.1 | ||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect | ||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the use of MIT code from cloudflare, the easiest is to continue to mark this overall as an MIT package, if that's acceptable to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, that's a mistake on my part. Fixed in 9606a68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the hompage there is wrong too. Remnants from an old package. Fixed in 4f4ccc5