netio

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: MIT Imports: 11 Imported by: 24

Documentation

Index

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 NetCopy

func NetCopy(input, output net.Conn) (err error)

func Read

func Read(input io.Reader, buffer []byte) (int, error)

func ReadPacket

func ReadPacket(input io.Reader, packet interface{}) error

ReadPacket read packet from node.Conn packet data start from the packet separator

func Write

func Write(output io.Writer, buffer []byte) (int, error)

func WritePacket

func WritePacket(output io.Writer, packet interface{}) error

WritePacket write packet to node.Conn

Types

This section is empty.

Jump to

Keyboard shortcuts

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