From 58cb05e302fcec400392e2f101e15a1c43eb4c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B2=B3?= Date: Fri, 29 Mar 2019 10:44:12 +0800 Subject: [PATCH] Snappy --- lib/conn/snappy.go | 3 +-- lib/rate/conn.go | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/conn/snappy.go b/lib/conn/snappy.go index 7ee0619..cfd33c4 100644 --- a/lib/conn/snappy.go +++ b/lib/conn/snappy.go @@ -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) diff --git a/lib/rate/conn.go b/lib/rate/conn.go index 06856b9..7e4ef01 100644 --- a/lib/rate/conn.go +++ b/lib/rate/conn.go @@ -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,