update sni handler

This commit is contained in:
ginuerzh
2022-04-14 14:53:13 +08:00
parent 7a334c173c
commit dca2a79c54
4 changed files with 102 additions and 84 deletions

View File

@ -1,20 +1,10 @@
package sni
import (
"net"
"io"
)
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)
type readWriter struct {
io.Reader
io.Writer
}