8// PrefixConn is a net.Conn prefixed with a reader that is first drained.
9// Used for STARTTLS where already did a buffered read of initial TLS data.
10type PrefixConn struct {
11 PrefixReader io.Reader // If not nil, reads are fulfilled from here. It is cleared when a read returns io.EOF.
15// Read returns data when PrefixReader when not nil, and net.Conn otherwise.
16func (c *PrefixConn) Read(buf []byte) (int, error) {
17 if c.PrefixReader != nil {
18 n, err := c.PrefixReader.Read(buf)
24 return c.Conn.Read(buf)