Skip to content

Commit

Permalink
Extract method Server.setRebindingConfig()
Browse files Browse the repository at this point in the history
  • Loading branch information
juniorz committed Dec 5, 2020
1 parent 28f2cca commit 8ab041f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
9 changes: 1 addition & 8 deletions internal/dnsforward/dnsforward_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,7 @@ func (s *Server) setConfig(dc dnsConfig) (restart bool) {
}
}

if dc.RebindingProtectionEnabled != nil {
s.conf.RebindingProtectionEnabled = *dc.RebindingProtectionEnabled
}

if dc.RebindingAllowedHosts != nil {
s.conf.RebindingAllowedHosts = *dc.RebindingAllowedHosts
restart = true
}
restart = restart || s.setRebindingConfig(dc)
s.Unlock()
s.conf.ConfigModified()
return restart
Expand Down
15 changes: 15 additions & 0 deletions internal/dnsforward/rebind.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ func processRebindingFilteringAfterResponse(ctx *dnsContext) int {
return resultDone
}

func (s *Server) setRebindingConfig(dc dnsConfig) bool {
restart := false

if dc.RebindingProtectionEnabled != nil {
s.conf.RebindingProtectionEnabled = *dc.RebindingProtectionEnabled
}

if dc.RebindingAllowedHosts != nil {
s.conf.RebindingAllowedHosts = *dc.RebindingAllowedHosts
restart = true
}

return restart
}

func (s *Server) preventRebindResponse(ctx *dnsContext) (*dnsfilter.Result, error) {
d := ctx.proxyCtx

Expand Down

0 comments on commit 8ab041f

Please sign in to comment.