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 (
|
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)
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue