add sni connector

This commit is contained in:
ginuerzh
2021-11-26 17:20:10 +08:00
parent 5b97b878fb
commit efbabd4052
14 changed files with 370 additions and 56 deletions

20
pkg/handler/sni/conn.go Normal file
View File

@ -0,0 +1,20 @@
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)
}