Esempio n. 1
0
File: proxy.go Progetto: sshic/cow
func newClientConn(rwc net.Conn, proxy *Proxy) *clientConn {
	buf := httpBuf.Get()
	c := &clientConn{
		Conn:       rwc,
		serverConn: map[string]*serverConn{},
		buf:        buf,
		bufRd:      bufio.NewReaderFromBuf(rwc, buf),
		proxy:      proxy,
	}
	return c
}
Esempio n. 2
0
func newClientConn(cli net.Conn, proxy Proxy) *clientConn {
	buf := httpBuf.Get()
	c := &clientConn{
		Conn:  cli,
		buf:   buf,
		bufRd: bufio.NewReaderFromBuf(cli, buf),
		proxy: proxy,
	}
	if debug {
		debug.Printf("cli(%s) connected, total %d clients\n",
			cli.RemoteAddr(), incCliCnt())
	}
	return c
}
Esempio n. 3
0
func (sv *serverConn) initBuf() {
	if sv.bufRd == nil {
		sv.buf = httpBuf.Get()
		sv.bufRd = bufio.NewReaderFromBuf(sv, sv.buf)
	}
}