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 {
|
restart = restart || s.setRebindingConfig(dc)
|
||||||
s.conf.RebindingProtectionEnabled = *dc.RebindingProtectionEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
if dc.RebindingAllowedHosts != nil {
|
|
||||||
s.conf.RebindingAllowedHosts = *dc.RebindingAllowedHosts
|
|
||||||
restart = true
|
|
||||||
}
|
|
||||||
s.Unlock()
|
s.Unlock()
|
||||||
s.conf.ConfigModified()
|
s.conf.ConfigModified()
|
||||||
return restart
|
return restart
|
||||||
|
|||||||
@@ -157,6 +157,21 @@ func processRebindingFilteringAfterResponse(ctx *dnsContext) int {
|
|||||||
return resultDone
|
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) {
|
func (s *Server) preventRebindResponse(ctx *dnsContext) (*dnsfilter.Result, error) {
|
||||||
d := ctx.proxyCtx
|
d := ctx.proxyCtx
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user