x/handler/sni/conn.go
2022-03-14 20:27:14 +08:00

21 lines
237 B
Go

package sni
import (
"net"
)
type cacheConn struct {
net.Conn
buf []byte
}
func (c *cacheConn) Read(b []byte) (n int, err error) {
if len(c.buf) > 0 {
n = copy(b, c.buf)
c.buf = c.buf[n:]
return
}
return c.Conn.Read(b)
}