chore: clean up code
This commit is contained in:
parent
fbabcfce94
commit
179bc6ecdf
1 changed files with 2 additions and 6 deletions
|
@ -1,9 +1,9 @@
|
||||||
package context
|
package context
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
CN "github.com/Dreamacro/clash/common/net"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
CN "github.com/Dreamacro/clash/common/net"
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/gofrs/uuid"
|
"github.com/gofrs/uuid"
|
||||||
)
|
)
|
||||||
|
@ -17,14 +17,10 @@ type ConnContext struct {
|
||||||
func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext {
|
func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext {
|
||||||
id, _ := uuid.NewV4()
|
id, _ := uuid.NewV4()
|
||||||
|
|
||||||
if _, ok := conn.(*CN.BufferedConn); !ok {
|
|
||||||
conn = CN.NewBufferedConn(conn)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ConnContext{
|
return &ConnContext{
|
||||||
id: id,
|
id: id,
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
conn: conn,
|
conn: CN.NewBufferedConn(conn),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue