Extract method Server.setRebindingConfig()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user