mirror of https://github.com/qwqdanchun/nps.git
Snappy
This commit is contained in:
parent
cc6d053b6d
commit
58cb05e302
|
@ -3,7 +3,6 @@ package conn
|
|||
import (
|
||||
"github.com/cnlh/nps/lib/pool"
|
||||
"github.com/cnlh/nps/vender/github.com/golang/snappy"
|
||||
"github.com/fatedier/frp/utils/net"
|
||||
"io"
|
||||
)
|
||||
|
||||
|
@ -12,7 +11,7 @@ type SnappyConn struct {
|
|||
r *snappy.Reader
|
||||
}
|
||||
|
||||
func NewSnappyConn(conn io.ReadWriteCloser) net.Conn {
|
||||
func NewSnappyConn(conn io.ReadWriteCloser) *SnappyConn {
|
||||
c := new(SnappyConn)
|
||||
c.w = snappy.NewBufferedWriter(conn)
|
||||
c.r = snappy.NewReader(conn)
|
||||
|
|
|
@ -2,15 +2,14 @@ package rate
|
|||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
)
|
||||
|
||||
type rateConn struct {
|
||||
conn net.Conn
|
||||
conn io.ReadWriteCloser
|
||||
rate *Rate
|
||||
}
|
||||
|
||||
func NewRateConn(conn net.Conn, rate *Rate) io.ReadWriteCloser {
|
||||
func NewRateConn(conn io.ReadWriteCloser, rate *Rate) io.ReadWriteCloser {
|
||||
return &rateConn{
|
||||
conn: conn,
|
||||
rate: rate,
|
||||
|
|
Loading…
Reference in New Issue