github.com/searKing/golang/go@v1.2.74/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 "github.com/searKing/golang/go/util/object" 12 ) 13 14 type TCPConn struct { 15 *bufio.ReadWriter 16 muRead sync.Mutex 17 muWrite sync.Mutex 18 } 19 20 func NewTCPConn(rw *bufio.ReadWriter) *TCPConn { 21 object.RequireNonNil(rw) 22 return &TCPConn{ 23 ReadWriter: rw, 24 } 25 }