MCPcopy
hub / github.com/bettercap/bettercap / BenchmarkHTTPProxyShouldProxy

Function BenchmarkHTTPProxyShouldProxy

modules/http_proxy/http_proxy_test.go:680–696  ·  view source on GitHub ↗

Benchmarks

(b *testing.B)

Source from the content-addressed store, hash-verified

678
679// Benchmarks
680func BenchmarkHTTPProxyShouldProxy(b *testing.B) {
681 sess, _ := createMockSession()
682 proxy := NewHTTPProxy(sess, "test")
683
684 proxy.Blacklist = []string{"*.evil.com", "bad.site.org", "*.malicious.net"}
685 proxy.Whitelist = []string{"*.good.com", "safe.site.org"}
686
687 req := &http.Request{
688 Host: "example.com",
689 }
690
691 b.ResetTimer()
692
693 for i := 0; i < b.N; i++ {
694 _ = proxy.shouldProxy(req)
695 }
696}
697
698func BenchmarkHTTPProxyStripPort(b *testing.B) {
699 testHost := "example.com:8080"

Callers

nothing calls this directly

Calls 3

shouldProxyMethod · 0.95
NewHTTPProxyFunction · 0.85
createMockSessionFunction · 0.70

Tested by

no test coverage detected