Skip to content
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

add disable ecs option #155

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doh-server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type config struct {
Tries uint `toml:"tries"`
Verbose bool `toml:"verbose"`
LogGuessedIP bool `toml:"log_guessed_client_ip"`
ECSDisable bool `toml:"ecs_disable"`
ECSAllowNonGlobalIP bool `toml:"ecs_allow_non_global_ip"`
ECSUsePreciseIP bool `toml:"ecs_use_precise_ip"`
TLSClientAuth bool `toml:"tls_client_auth"`
Expand Down
4 changes: 4 additions & 0 deletions doh-server/doh-server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ verbose = false
# Note: http uri/useragent log cannot be controlled by this config
log_guessed_client_ip = false

# Disable ECS
# If this item is set to true, edns will not work.
ecs_disable = false;

# By default, non global IP addresses are never forwarded to upstream servers.
# This is to prevent two things from happening:
# 1. the upstream server knowing your private LAN addresses;
Expand Down
4 changes: 4 additions & 0 deletions doh-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) {
}

func (s *Server) findClientIP(r *http.Request) net.IP {
if s.conf.ECSDisable {
return nil
}

noEcs := r.URL.Query().Get("no_ecs")
if strings.EqualFold(noEcs, "true") {
return nil
Expand Down