package http import ( "crypto/tls" "fmt" "log" "net" "testing" "time" "git.loafle.net/overflow/overflow_discovery/service/matcher" ) func TestHTTPSMatcher_Match(t *testing.T) { info := matcher.NewMatchInfo("192.168.1.10", 10443) netinfo := "192.168.1.10:10443" dialer := &net.Dialer{ Timeout: 5 * time.Second, } conn, err := tls.DialWithDialer( dialer, "tcp", netinfo, &tls.Config{ InsecureSkipVerify: true, ServerName: "192.168.1.103", }, ) if err != nil { log.Println(err) return } defer conn.Close() //fmt.Println(conn) h := NewMatcher() pac := h.Packet(0) //fmt.Println(pac) //fmt.Println(pac.Buffer) //bytes := make([]byte, 1024) l, _ := conn.Write(pac.Buffer) buf := make([]byte, 1024) l, _ = conn.Read(buf) fmt.Println(string(buf)) fmt.Println(l) is := h.Match(info, 0, matcher.NewPacket(buf, l)) fmt.Println(is) }