This commit is contained in:
刘河 2019-03-29 10:44:12 +08:00
parent cc6d053b6d
commit 58cb05e302
2 changed files with 3 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package conn
import ( import (
"github.com/cnlh/nps/lib/pool" "github.com/cnlh/nps/lib/pool"
"github.com/cnlh/nps/vender/github.com/golang/snappy" "github.com/cnlh/nps/vender/github.com/golang/snappy"
"github.com/fatedier/frp/utils/net"
"io" "io"
) )
@ -12,7 +11,7 @@ type SnappyConn struct {
r *snappy.Reader r *snappy.Reader
} }
func NewSnappyConn(conn io.ReadWriteCloser) net.Conn { func NewSnappyConn(conn io.ReadWriteCloser) *SnappyConn {
c := new(SnappyConn) c := new(SnappyConn)
c.w = snappy.NewBufferedWriter(conn) c.w = snappy.NewBufferedWriter(conn)
c.r = snappy.NewReader(conn) c.r = snappy.NewReader(conn)

View File

@ -2,15 +2,14 @@ package rate
import ( import (
"io" "io"
"net"
) )
type rateConn struct { type rateConn struct {
conn net.Conn conn io.ReadWriteCloser
rate *Rate rate *Rate
} }
func NewRateConn(conn net.Conn, rate *Rate) io.ReadWriteCloser { func NewRateConn(conn io.ReadWriteCloser, rate *Rate) io.ReadWriteCloser {
return &rateConn{ return &rateConn{
conn: conn, conn: conn,
rate: rate, rate: rate,