github.com/searKing/golang/go@v1.2.117/net/tcp/wrapper.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package tcp 6 7 import ( 8 "bufio" 9 "sync" 10 ) 11 12 type TCPConn struct { 13 *bufio.ReadWriter 14 muRead sync.Mutex 15 muWrite sync.Mutex 16 } 17 18 func NewTCPConn(rw *bufio.ReadWriter) *TCPConn { 19 if rw == nil { 20 panic("nil io.ReadWriter") 21 } 22 return &TCPConn{ 23 ReadWriter: rw, 24 } 25 }