MCPcopy
hub / github.com/bettercap/bettercap / OnRequest

Method OnRequest

modules/dns_proxy/dns_proxy_script.go:79–95  ·  view source on GitHub ↗
(req *dns.Msg, clientIP string)

Source from the content-addressed store, hash-verified

77}
78
79func (s *DnsProxyScript) OnRequest(req *dns.Msg, clientIP string) (jsreq, jsres *JSQuery) {
80 if s.doOnRequest {
81 jsreq := NewJSQuery(req, clientIP)
82 jsres := NewJSQuery(req, clientIP)
83
84 if _, err := s.Call("onRequest", jsreq, jsres); err != nil {
85 log.Error("%s", err)
86 return nil, nil
87 } else if jsreq.CheckIfModifiedAndUpdateHash() {
88 return jsreq, nil
89 } else if jsres.CheckIfModifiedAndUpdateHash() {
90 return nil, jsres
91 }
92 }
93
94 return nil, nil
95}
96
97func (s *DnsProxyScript) OnResponse(req, res *dns.Msg, clientIP string) (jsreq, jsres *JSQuery) {
98 if s.doOnResponse {

Callers 1

onRequestFilterMethod · 0.45

Calls 3

ErrorFunction · 0.92
NewJSQueryFunction · 0.85

Tested by

no test coverage detected