函数定义#
Connect#
详细描述#
Connect(host string, port any, opts ...dialerOpt) (*tcpConnection, error)
| 参数名 | 参数类型 | 参数解释 |
|---|
| host | string | |
| port | any | |
| opts | ...dialerOpt | |
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | *tcpConnection | |
| r2 | error | |
Forward#
详细描述#
Forward(localPort int, remoteHost string, remotePort int) error
| 参数名 | 参数类型 | 参数解释 |
|---|
| localPort | int | |
| remoteHost | string | |
| remotePort | int | |
返回值#
MockServe#
详细描述#
MockServe(rsp []byte) (string, int)
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | string | |
| r2 | int | |
MockTCPProtocol#
详细描述#
MockTCPProtocol(name string) (string, int)
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | string | |
| r2 | int | |
Serve#
详细描述#
Serve(host any, port int, opts ...TcpServerConfigOpt) error
| 参数名 | 参数类型 | 参数解释 |
|---|
| host | any | |
| port | int | |
| opts | ...TcpServerConfigOpt | |
返回值#
clientLocal#
详细描述#
clientLocal(i any) dialerOpt
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | dialerOpt | |
clientProxy#
详细描述#
clientProxy(proxy string) dialerOpt
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | dialerOpt | |
clientTimeout#
详细描述#
clientTimeout(i float64) dialerOpt
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | dialerOpt | |
clientTls#
详细描述#
clientTls(crt any, key any, caCerts ...any) dialerOpt
| 参数名 | 参数类型 | 参数解释 |
|---|
| crt | any | |
| key | any | |
| caCerts | ...any | |
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | dialerOpt | |
serverCallback#
详细描述#
serverCallback(cb func(connection *tcpConnection)) TcpServerConfigOpt
| 参数名 | 参数类型 | 参数解释 |
|---|
| cb | func(connection *tcpConnection) | |
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | TcpServerConfigOpt | |
serverContext#
详细描述#
serverContext(ctx context.Context) TcpServerConfigOpt
| 参数名 | 参数类型 | 参数解释 |
|---|
| ctx | context.Context | |
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | TcpServerConfigOpt | |
serverTls#
详细描述#
serverTls(crt any, key any, cas ...any) TcpServerConfigOpt
| 参数名 | 参数类型 | 参数解释 |
|---|
| crt | any | |
| key | any | |
| cas | ...any | |
返回值#
| 返回值(顺序) | 返回值类型 | 返回值解释 |
|---|
| r1 | TcpServerConfigOpt | |