socket

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 9 Imported by: 0

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

View Source
const (
	UDP byte = 0
	TCP byte = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Dial(address string) (*Socket, error)
	DialTimeout(address string, timeout time.Duration) (*Socket, error)
	Conn() net.Conn
	Close() error
}

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) Close

func (m *MockClient) Close() error

Close mocks base method.

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

func (m *MockClient) DialTimeout(address string, timeout time.Duration) (*Socket, error)

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) Close

func (m *MockConn) Close() error

Close mocks base method.

func (*MockConn) EXPECT

func (m *MockConn) EXPECT() *MockConnMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConn) LocalAddr

func (m *MockConn) LocalAddr() net.Addr

LocalAddr mocks base method.

func (*MockConn) Read

func (m *MockConn) Read(arg0 []byte) (int, error)

Read mocks base method.

func (*MockConn) RemoteAddr

func (m *MockConn) RemoteAddr() net.Addr

RemoteAddr mocks base method.

func (*MockConn) SetDeadline

func (m *MockConn) SetDeadline(arg0 time.Time) error

SetDeadline mocks base method.

func (*MockConn) SetReadDeadline

func (m *MockConn) SetReadDeadline(arg0 time.Time) error

SetReadDeadline mocks base method.

func (*MockConn) SetWriteDeadline

func (m *MockConn) SetWriteDeadline(arg0 time.Time) error

SetWriteDeadline mocks base method.

func (*MockConn) Write

func (m *MockConn) Write(arg0 []byte) (int, error)

Write 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.

func (*MockConnMockRecorder) Write

func (mr *MockConnMockRecorder) Write(arg0 any) *gomock.Call

Write indicates an expected call of Write.

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) Bind

func (m *MockServer) Bind() error

Bind mocks base method.

func (*MockServer) Close

func (m *MockServer) Close() error

Close mocks base method.

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 Server

type Server interface {
	Bind() error
	Listen() (*Socket, error)
	Listener() net.Listener
	ListenAddr() net.Addr
	Close() error
}

type Socket

type Socket struct {
	Reader *bufio.Reader
	Writer *bufio.Writer
	// contains filtered or unexported fields
}

func NewSocket

func NewSocket(conn net.Conn) *Socket

func NewSocketUDP added in v1.5.1

func NewSocketUDP(conn net.Conn, udpWrap *UdpWrap) *Socket

func (*Socket) Close

func (p *Socket) Close() error

func (*Socket) Conn added in v1.4.2

func (p *Socket) Conn() net.Conn

func (*Socket) Flush added in v1.4.1

func (p *Socket) Flush() error

func (*Socket) IsTcp added in v1.5.1

func (p *Socket) IsTcp() bool

func (*Socket) IsUdp added in v1.5.1

func (p *Socket) IsUdp() bool

func (*Socket) LocalAddr

func (p *Socket) LocalAddr() net.Addr

func (*Socket) Read added in v1.4.1

func (p *Socket) Read(buf []byte) (n int, err error)

func (*Socket) ReaderBytes

func (p *Socket) ReaderBytes(bytes []byte) (int, error)

func (*Socket) RemoteAddr

func (p *Socket) RemoteAddr() net.Addr

func (*Socket) UdpWrap added in v1.5.1

func (p *Socket) UdpWrap() *UdpWrap

func (*Socket) Wait

func (p *Socket) Wait() error

func (*Socket) Write added in v1.4.1

func (p *Socket) Write(buf []byte) (n int, err error)

func (*Socket) WriterBytes

func (p *Socket) WriterBytes(bytes []byte) error

type TcpClient

type TcpClient struct {
	// contains filtered or unexported fields
}

func NewTcpClient

func NewTcpClient() *TcpClient

func (*TcpClient) Close

func (t *TcpClient) Close() error

func (*TcpClient) Conn added in v1.5.1

func (t *TcpClient) Conn() net.Conn

func (*TcpClient) Dial added in v1.4.1

func (t *TcpClient) Dial(address string) (*Socket, error)

func (*TcpClient) DialTimeout added in v1.4.1

func (t *TcpClient) DialTimeout(address string, timeout time.Duration) (*Socket, error)

type TcpServer

type TcpServer struct {
	// contains filtered or unexported fields
}

func NewTcpServer

func NewTcpServer(addr string) *TcpServer

NewTcpServer 设置tcp监听地址, 如 localhost:8080、127.0.0.1:8080、0.0.0.0:8080、:8080

func (*TcpServer) Bind added in v1.5.1

func (t *TcpServer) Bind() error

func (*TcpServer) Close

func (t *TcpServer) Close() error

func (*TcpServer) Listen

func (t *TcpServer) Listen() (*Socket, error)

func (*TcpServer) ListenAddr added in v1.6.1

func (t *TcpServer) ListenAddr() net.Addr

func (*TcpServer) Listener added in v1.4.2

func (t *TcpServer) Listener() net.Listener

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

func (*UdpClient) Close added in v1.5.1

func (u *UdpClient) Close() error

func (*UdpClient) Conn added in v1.5.1

func (u *UdpClient) Conn() net.Conn

func (*UdpClient) Dial added in v1.5.1

func (u *UdpClient) Dial(address string) (*Socket, error)

func (*UdpClient) DialTimeout added in v1.5.1

func (u *UdpClient) DialTimeout(address string, timeout time.Duration) (*Socket, error)

type UdpServer added in v1.5.1

type UdpServer struct {
	// contains filtered or unexported fields
}

func NewUdpServer added in v1.5.1

func NewUdpServer(addr string) *UdpServer

func (*UdpServer) Bind added in v1.5.1

func (u *UdpServer) Bind() error

func (*UdpServer) Close added in v1.5.1

func (u *UdpServer) Close() error

func (*UdpServer) Listen added in v1.5.1

func (u *UdpServer) Listen() (*Socket, error)

func (*UdpServer) ListenAddr added in v1.6.1

func (u *UdpServer) ListenAddr() net.Addr

func (*UdpServer) Listener added in v1.5.1

func (u *UdpServer) Listener() net.Listener

func (*UdpServer) UdpConn added in v1.5.1

func (u *UdpServer) UdpConn() *net.UDPConn

type UdpWrap added in v1.5.1

type UdpWrap struct {
	// contains filtered or unexported fields
}

func (*UdpWrap) Conn added in v1.5.1

func (u *UdpWrap) Conn() *net.UDPConn

func (*UdpWrap) Read added in v1.5.1

func (u *UdpWrap) Read(p []byte) (n int, err error)

func (*UdpWrap) RemoteAddr added in v1.5.1

func (u *UdpWrap) RemoteAddr() net.Addr

func (*UdpWrap) Write added in v1.5.1

func (u *UdpWrap) Write(p []byte) (n int, err error)

func (*UdpWrap) WriteAddr added in v1.6.1

func (u *UdpWrap) WriteAddr(p []byte, addr *net.UDPAddr) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL