使用以下代码拦截 read on a net.Conn: type wrap { // Conn is the wrapped net.Conn. // Because it's an embedded field, the // net.Conn methods are automatically promoted // to wrap. net.Conn } // Read calls through to the wrapped read and // prints the bytes that flow through. Replace // the print statement with whatever is appropriate // for your application. func (w wrap) Read(p []byte) (int, error) { n, err := w.Conn.Read() fmt.Printf("%x\n", p[:n]) // example return n, err }像这样包裹: tnc, err :=tls.Client(wrap{nc}, &tls.Config{})