mitm, templates, context: Pool buffers to reduce allocations

Also disable some tests on context.Hostname because they're not portable
This commit is contained in:
Matthew Holt
2017-04-21 19:54:25 -06:00
parent f8614b877d
commit 0a798aafac
6 changed files with 53 additions and 16 deletions

View File

@ -251,14 +251,16 @@ func TestHostname(t *testing.T) {
inputRemoteAddr string
expectedHostname string
}{
// TODO(mholt): Fix these tests, they're not portable. i.e. my resolver
// returns "fwdr-8.fwdr-8.fwdr-8.fwdr-8." instead of these google ones.
// Test 0 - ipv4 with port
{"8.8.8.8:1111", "google-public-dns-a.google.com."},
// Test 1 - ipv4 without port
{"8.8.8.8", "google-public-dns-a.google.com."},
// Test 2 - ipv6 with port
{"[2001:4860:4860::8888]:11", "google-public-dns-a.google.com."},
// Test 3 - ipv6 without port and brackets
{"2001:4860:4860::8888", "google-public-dns-a.google.com."},
// {"8.8.8.8:1111", "google-public-dns-a.google.com."},
// // Test 1 - ipv4 without port
// {"8.8.8.8", "google-public-dns-a.google.com."},
// // Test 2 - ipv6 with port
// {"[2001:4860:4860::8888]:11", "google-public-dns-a.google.com."},
// // Test 3 - ipv6 without port and brackets
// {"2001:4860:4860::8888", "google-public-dns-a.google.com."},
// Test 4 - no hostname available
{"1.1.1.1", "1.1.1.1"},
}