Benchmarks
(b *testing.B)
| 678 | |
| 679 | // Benchmarks |
| 680 | func 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 | |
| 698 | func BenchmarkHTTPProxyStripPort(b *testing.B) { |
| 699 | testHost := "example.com:8080" |
nothing calls this directly
no test coverage detected