diff options
Diffstat (limited to 'tcpproxy_test.go')
-rw-r--r-- | tcpproxy_test.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tcpproxy_test.go b/tcpproxy_test.go index 45d8b0e..7150372 100644 --- a/tcpproxy_test.go +++ b/tcpproxy_test.go @@ -27,6 +27,10 @@ import ( "testing" ) +type noopTarget struct{} + +func (t *noopTarget) HandleConn(net.Conn) {} + func TestMatchHTTPHost(t *testing.T) { tests := []struct { name string @@ -53,6 +57,7 @@ func TestMatchHTTPHost(t *testing.T) { want: true, }, } + target := &noopTarget{} for i, tt := range tests { name := tt.name if name == "" { @@ -60,8 +65,8 @@ func TestMatchHTTPHost(t *testing.T) { } t.Run(name, func(t *testing.T) { br := bufio.NewReader(tt.r) - var matcher matcher = httpHostMatch(tt.host) - got := matcher.match(br) + r := httpHostMatch{tt.host, target} + got := r.match(br) != nil if got != tt.want { t.Fatalf("match = %v; want %v", got, tt.want) } |