internal/protocol/sniffer.go
func NewSniffer(conn net.Conn, dbAddr string) (*Sniffer, error) {
	s := &Sniffer{
		conn:   conn,
		dbAddr: dbAddr,
		clRd:   bufio.NewReader(conn),
		clWr:   bufio.NewWriter(conn),
		mh:     &messageHeader{},
		sh:     &segmentHeader{},
		ph:     &partHeader{},
		buf:    make([]byte, 0),
	}

	dbConn, err := net.Dial("tcp", s.dbAddr)
	if err != nil {
		return nil, err
	}

	s.dbRd = bufio.NewReader(dbConn)
	s.dbWr = bufio.NewWriter(dbConn)
	s.dbConn = dbConn
	return s, nil
}
func NewSniffer(conn net.Conn, dbAddr string) (*Sniffer, error) {
	s := &Sniffer{
		conn:   conn,
		dbAddr: dbAddr,
		clRd:   bufio.NewReader(conn),
		clWr:   bufio.NewWriter(conn),
		mh:     &messageHeader{},
		sh:     &segmentHeader{},
		ph:     &partHeader{},
		buf:    make([]byte, 0),
	}

	dbConn, err := net.Dial("tcp", s.dbAddr)
	if err != nil {
		return nil, err
	}

	s.dbRd = bufio.NewReader(dbConn)
	s.dbWr = bufio.NewWriter(dbConn)
	s.dbConn = dbConn
	return s, nil
}
func NewSniffer ( conn net . Conn , dbAddr string ) ( * Sniffer , error ) { s := & Sniffer { conn : conn , dbAddr : dbAddr , clRd : bufio . NewReader ( conn ) , clWr : bufio . NewWriter ( conn ) , mh : & messageHeader { } , sh : & segmentHeader { } , ph : & partHeader { } , buf : make ( [ ] byte , 0 ) , } dbConn , err := net . Dial ( " " , s . dbAddr ) if err != nil { return nil , err } s . dbRd = bufio . NewReader ( dbConn ) s . dbWr = bufio . NewWriter ( dbConn ) s . dbConn = dbConn return s , nil }
// NewSniffer creates a new sniffer instance. The conn parameter is the net.Conn connection, where the Sniffer
// is listening for hdb protocol calls. The dbAddr is the hdb host port address in "host:port" format.
NewSniffer creates a new sniffer instance . The conn parameter is the net . Conn connection where the Sniffer is listening for hdb protocol calls . The dbAddr is the hdb host port address in host : port format .