Skip to main content

tcp

成员函数函数描述/介绍
tcp.Connect
tcp.Forward
tcp.MockServe
tcp.MockTCPProtocol
tcp.Serve
tcp.clientLocal
tcp.clientProxy
tcp.clientTimeout
tcp.clientTls
tcp.serverCallback
tcp.serverContext
tcp.serverTls

函数定义#

Connect#

详细描述#

定义#

Connect(host string, port any, opts ...dialerOpt) (*tcpConnection, error)

参数#

参数名参数类型参数解释
hoststring
portany
opts...dialerOpt

返回值#

返回值(顺序)返回值类型返回值解释
r1*tcpConnection
r2error

Forward#

详细描述#

定义#

Forward(localPort int, remoteHost string, remotePort int) error

参数#

参数名参数类型参数解释
localPortint
remoteHoststring
remotePortint

返回值#

返回值(顺序)返回值类型返回值解释
r1error

MockServe#

详细描述#

定义#

MockServe(rsp []byte) (string, int)

参数#

参数名参数类型参数解释
rsp[]byte

返回值#

返回值(顺序)返回值类型返回值解释
r1string
r2int

MockTCPProtocol#

详细描述#

定义#

MockTCPProtocol(name string) (string, int)

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1string
r2int

Serve#

详细描述#

定义#

Serve(host any, port int, opts ...TcpServerConfigOpt) error

参数#

参数名参数类型参数解释
hostany
portint
opts...TcpServerConfigOpt

返回值#

返回值(顺序)返回值类型返回值解释
r1error

clientLocal#

详细描述#

定义#

clientLocal(i any) dialerOpt

参数#

参数名参数类型参数解释
iany

返回值#

返回值(顺序)返回值类型返回值解释
r1dialerOpt

clientProxy#

详细描述#

定义#

clientProxy(proxy string) dialerOpt

参数#

参数名参数类型参数解释
proxystring

返回值#

返回值(顺序)返回值类型返回值解释
r1dialerOpt

clientTimeout#

详细描述#

定义#

clientTimeout(i float64) dialerOpt

参数#

参数名参数类型参数解释
ifloat64

返回值#

返回值(顺序)返回值类型返回值解释
r1dialerOpt

clientTls#

详细描述#

定义#

clientTls(crt any, key any, caCerts ...any) dialerOpt

参数#

参数名参数类型参数解释
crtany
keyany
caCerts...any

返回值#

返回值(顺序)返回值类型返回值解释
r1dialerOpt

serverCallback#

详细描述#

定义#

serverCallback(cb func(connection *tcpConnection)) TcpServerConfigOpt

参数#

参数名参数类型参数解释
cbfunc(connection *tcpConnection)

返回值#

返回值(顺序)返回值类型返回值解释
r1TcpServerConfigOpt

serverContext#

详细描述#

定义#

serverContext(ctx context.Context) TcpServerConfigOpt

参数#

参数名参数类型参数解释
ctxcontext.Context

返回值#

返回值(顺序)返回值类型返回值解释
r1TcpServerConfigOpt

serverTls#

详细描述#

定义#

serverTls(crt any, key any, cas ...any) TcpServerConfigOpt

参数#

参数名参数类型参数解释
crtany
keyany
cas...any

返回值#

返回值(顺序)返回值类型返回值解释
r1TcpServerConfigOpt