Documentation ¶
Index ¶
- Constants
- Variables
- func InitNode(tcpType string, tcpService string, handlerFunc func(net.Conn), portReuse bool, ...) (err error)
- func InitTCP(tcpType string, tcpService string, peerNodeID string, ...) (err error)
- func NetCopy(input, output net.Conn) (err error)
- func Read(input io.Reader, buffer []byte) (int, error)
- func ReadPacket(input io.Reader, packet interface{}) error
- func Write(output io.Writer, buffer []byte) (int, error)
- func WritePacket(output io.Writer, packet interface{}) error
Constants ¶
View Source
const TIMEOUT = 2
Variables ¶
View Source
var INIT_TYPE_ERROR = errors.New("init type error")
Functions ¶
func InitNode ¶
func InitNode(tcpType string, tcpService string, handlerFunc func(net.Conn), portReuse bool, reusedPort uint16) (err error)
InitNode 初始化节点间网络连接 handleFunc 处理net.Conn的函数 portReuse 是否以端口重用的方式初始化网络连接 reusedPort 被复用的端口,如果不使用端口复用,直接置零即可
func InitTCP ¶
func InitTCP(tcpType string, tcpService string, peerNodeID string, handlerFunc func(net.Conn, string, chan bool, ...interface{}), args ...interface{}) (err error)
InitNode 初始化网络连接 peerNodeID 存储需要通信(socks5/端口转发)的对端节点ID
func ReadPacket ¶
ReadPacket read packet from node.Conn packet data start from the packet separator
func WritePacket ¶
WritePacket write packet to node.Conn
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.