Documentation ¶
Overview ¶
Package socket is a generated GoMock package.
Package mock_net is a generated GoMock package.
Package socket is a generated GoMock package.
Index ¶
- Constants
- type Client
- type MockClient
- type MockClientMockRecorder
- type MockConn
- func (m *MockConn) Close() error
- func (m *MockConn) EXPECT() *MockConnMockRecorder
- func (m *MockConn) LocalAddr() net.Addr
- func (m *MockConn) Read(arg0 []byte) (int, error)
- func (m *MockConn) RemoteAddr() net.Addr
- func (m *MockConn) SetDeadline(arg0 time.Time) error
- func (m *MockConn) SetReadDeadline(arg0 time.Time) error
- func (m *MockConn) SetWriteDeadline(arg0 time.Time) error
- func (m *MockConn) Write(arg0 []byte) (int, error)
- type MockConnMockRecorder
- func (mr *MockConnMockRecorder) Close() *gomock.Call
- func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call
- func (mr *MockConnMockRecorder) Read(arg0 any) *gomock.Call
- func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call
- func (mr *MockConnMockRecorder) SetDeadline(arg0 any) *gomock.Call
- func (mr *MockConnMockRecorder) SetReadDeadline(arg0 any) *gomock.Call
- func (mr *MockConnMockRecorder) SetWriteDeadline(arg0 any) *gomock.Call
- func (mr *MockConnMockRecorder) Write(arg0 any) *gomock.Call
- type MockServer
- type MockServerMockRecorder
- type Server
- type Socket
- func (p *Socket) Close() error
- func (p *Socket) Conn() net.Conn
- func (p *Socket) Flush() error
- func (p *Socket) IsTcp() bool
- func (p *Socket) IsUdp() bool
- func (p *Socket) LocalAddr() net.Addr
- func (p *Socket) Read(buf []byte) (n int, err error)
- func (p *Socket) ReaderBytes(bytes []byte) (int, error)
- func (p *Socket) RemoteAddr() net.Addr
- func (p *Socket) UdpWrap() *UdpWrap
- func (p *Socket) Wait() error
- func (p *Socket) Write(buf []byte) (n int, err error)
- func (p *Socket) WriterBytes(bytes []byte) error
- type TcpClient
- type TcpServer
- type UdpClient
- type UdpServer
- type UdpWrap
Constants ¶
const ( UDP byte = 0 TCP byte = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) Dial ¶ added in v1.4.2
func (m *MockClient) Dial(address string) (*Socket, error)
Dial mocks base method.
func (*MockClient) DialTimeout ¶ added in v1.4.2
DialTimeout mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) Close ¶
func (mr *MockClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockClientMockRecorder) Dial ¶ added in v1.4.2
func (mr *MockClientMockRecorder) Dial(address any) *gomock.Call
Dial indicates an expected call of Dial.
func (*MockClientMockRecorder) DialTimeout ¶ added in v1.4.2
func (mr *MockClientMockRecorder) DialTimeout(address, timeout any) *gomock.Call
DialTimeout indicates an expected call of DialTimeout.
type MockConn ¶
type MockConn struct {
// contains filtered or unexported fields
}
MockConn is a mock of Conn interface.
func NewMockConn ¶
func NewMockConn(ctrl *gomock.Controller) *MockConn
NewMockConn creates a new mock instance.
func (*MockConn) EXPECT ¶
func (m *MockConn) EXPECT() *MockConnMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConn) RemoteAddr ¶
RemoteAddr mocks base method.
func (*MockConn) SetDeadline ¶
SetDeadline mocks base method.
func (*MockConn) SetReadDeadline ¶
SetReadDeadline mocks base method.
func (*MockConn) SetWriteDeadline ¶
SetWriteDeadline mocks base method.
type MockConnMockRecorder ¶
type MockConnMockRecorder struct {
// contains filtered or unexported fields
}
MockConnMockRecorder is the mock recorder for MockConn.
func (*MockConnMockRecorder) Close ¶
func (mr *MockConnMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockConnMockRecorder) LocalAddr ¶
func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call
LocalAddr indicates an expected call of LocalAddr.
func (*MockConnMockRecorder) Read ¶
func (mr *MockConnMockRecorder) Read(arg0 any) *gomock.Call
Read indicates an expected call of Read.
func (*MockConnMockRecorder) RemoteAddr ¶
func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call
RemoteAddr indicates an expected call of RemoteAddr.
func (*MockConnMockRecorder) SetDeadline ¶
func (mr *MockConnMockRecorder) SetDeadline(arg0 any) *gomock.Call
SetDeadline indicates an expected call of SetDeadline.
func (*MockConnMockRecorder) SetReadDeadline ¶
func (mr *MockConnMockRecorder) SetReadDeadline(arg0 any) *gomock.Call
SetReadDeadline indicates an expected call of SetReadDeadline.
func (*MockConnMockRecorder) SetWriteDeadline ¶
func (mr *MockConnMockRecorder) SetWriteDeadline(arg0 any) *gomock.Call
SetWriteDeadline indicates an expected call of SetWriteDeadline.
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer is a mock of Server interface.
func NewMockServer ¶
func NewMockServer(ctrl *gomock.Controller) *MockServer
NewMockServer creates a new mock instance.
func (*MockServer) EXPECT ¶
func (m *MockServer) EXPECT() *MockServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockServer) Listen ¶
func (m *MockServer) Listen() (*Socket, error)
Listen mocks base method.
func (*MockServer) ListenAddr ¶ added in v1.6.1
func (m *MockServer) ListenAddr() net.Addr
ListenAddr mocks base method.
func (*MockServer) Listener ¶ added in v1.4.2
func (m *MockServer) Listener() net.Listener
Listener mocks base method.
type MockServerMockRecorder ¶
type MockServerMockRecorder struct {
// contains filtered or unexported fields
}
MockServerMockRecorder is the mock recorder for MockServer.
func (*MockServerMockRecorder) Bind ¶
func (mr *MockServerMockRecorder) Bind() *gomock.Call
Bind indicates an expected call of Bind.
func (*MockServerMockRecorder) Close ¶
func (mr *MockServerMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockServerMockRecorder) Listen ¶
func (mr *MockServerMockRecorder) Listen() *gomock.Call
Listen indicates an expected call of Listen.
func (*MockServerMockRecorder) ListenAddr ¶ added in v1.6.1
func (mr *MockServerMockRecorder) ListenAddr() *gomock.Call
ListenAddr indicates an expected call of ListenAddr.
func (*MockServerMockRecorder) Listener ¶ added in v1.4.2
func (mr *MockServerMockRecorder) Listener() *gomock.Call
Listener indicates an expected call of Listener.
type Socket ¶
type Socket struct { Reader *bufio.Reader Writer *bufio.Writer // contains filtered or unexported fields }
func (*Socket) RemoteAddr ¶
func (*Socket) WriterBytes ¶
type TcpClient ¶
type TcpClient struct {
// contains filtered or unexported fields
}
func NewTcpClient ¶
func NewTcpClient() *TcpClient
type TcpServer ¶
type TcpServer struct {
// contains filtered or unexported fields
}
func NewTcpServer ¶
NewTcpServer 设置tcp监听地址, 如 localhost:8080、127.0.0.1:8080、0.0.0.0:8080、:8080
func (*TcpServer) ListenAddr ¶ added in v1.6.1
type UdpClient ¶ added in v1.5.1
type UdpClient struct {
// contains filtered or unexported fields
}
func NewUdpClient ¶ added in v1.5.1
func NewUdpClient() *UdpClient
type UdpServer ¶ added in v1.5.1
type UdpServer struct {
// contains filtered or unexported fields
}
func NewUdpServer ¶ added in v1.5.1
func (*UdpServer) ListenAddr ¶ added in v1.6.1
type UdpWrap ¶ added in v1.5.1
type UdpWrap struct {
// contains filtered or unexported fields
}