package http import ( "crypto/tls" "fmt" "log" "net" "testing" "time" cnsm "git.loafle.net/commons_go/network_service_matcher" ) func TestHTTPSMatcher_Match(t *testing.T) { info := cnsm.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, cnsm.NewPacket(buf, l)) fmt.Println(is) }