connect

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link interface {
	events.EventInterface

	Id() int64

	Write(data []byte) error

	Close() error

	Running() bool

	First() bool

	//Pipe 透传
	Pipe(pipe io.ReadWriteCloser)

	//Ask 发送指令,接收数据
	Ask(cmd []byte, timeout time.Duration) ([]byte, error)
}

Link 链接

type NetClient

type NetClient struct {
	events.EventEmitter
	// contains filtered or unexported fields
}

NetClient 网络链接

func (*NetClient) Close

func (client *NetClient) Close() error

Close 关闭

func (client *NetClient) GetLink(id int64) Link

GetLink 获取链接

func (*NetClient) Open

func (client *NetClient) Open() error

Open 打开

func (*NetClient) Running

func (client *NetClient) Running() bool
type NetLink struct {
	// contains filtered or unexported fields
}

NetLink 网络连接

func (*NetLink) Ask added in v1.1.0

func (l *NetLink) Ask(cmd []byte, timeout time.Duration) ([]byte, error)

func (*NetLink) Close

func (l *NetLink) Close() error

Close 关闭

func (*NetLink) First

func (l *NetLink) First() bool

func (*NetLink) Id

func (l *NetLink) Id() int64

func (*NetLink) Pipe

func (l *NetLink) Pipe(pipe io.ReadWriteCloser)

func (*NetLink) Read

func (l *NetLink) Read(data []byte) (int, error)

Read 读

func (*NetLink) Running

func (l *NetLink) Running() bool

func (*NetLink) Write

func (l *NetLink) Write(data []byte) error

Write 写

type Serial

type Serial struct {
	events.EventEmitter
	// contains filtered or unexported fields
}

Serial 串口

func (*Serial) Close

func (s *Serial) Close() error

Close 关闭

func (s *Serial) GetLink(id int64) Link

func (*Serial) Open

func (s *Serial) Open() error

Open 打开

func (*Serial) Running

func (s *Serial) Running() bool
type SerialLink struct {
	// contains filtered or unexported fields
}

SerialLink 串口连接

func (*SerialLink) Ask added in v1.1.0

func (l *SerialLink) Ask(cmd []byte, timeout time.Duration) ([]byte, error)

func (*SerialLink) Close

func (l *SerialLink) Close() error

Close 关闭

func (*SerialLink) First

func (l *SerialLink) First() bool

func (*SerialLink) Id

func (l *SerialLink) Id() int64

func (*SerialLink) Pipe

func (l *SerialLink) Pipe(pipe io.ReadWriteCloser)

func (*SerialLink) Running

func (l *SerialLink) Running() bool

func (*SerialLink) Write

func (l *SerialLink) Write(data []byte) error

Write 写

type TcpServer

type TcpServer struct {
	events.EventEmitter
	// contains filtered or unexported fields
}

TcpServer TCP服务器

func (*TcpServer) Close

func (server *TcpServer) Close() (err error)

Close 关闭

func (server *TcpServer) GetLink(id int64) Link

GetLink 获取连接

func (*TcpServer) Open

func (server *TcpServer) Open() error

Open 打开

func (*TcpServer) Running

func (server *TcpServer) Running() bool

type Tunnel

type Tunnel interface {
	events.EventInterface

	Open() error
	Close() error
	GetLink(id int64) Link
	Running() bool
}

Tunnel 通道

func NewTunnel

func NewTunnel(tunnel *model.Tunnel) (Tunnel, error)

NewTunnel 创建通道

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

UdpLink UDP链接

func (*UdpLink) Ask added in v1.1.0

func (l *UdpLink) Ask(cmd []byte, timeout time.Duration) ([]byte, error)

func (*UdpLink) Close

func (l *UdpLink) Close() error

Close 关闭

func (*UdpLink) First

func (l *UdpLink) First() bool

func (*UdpLink) Id

func (l *UdpLink) Id() int64

func (*UdpLink) Pipe

func (l *UdpLink) Pipe(pipe io.ReadWriteCloser)

func (*UdpLink) Running

func (l *UdpLink) Running() bool

func (*UdpLink) Write

func (l *UdpLink) Write(data []byte) error

Write 写

type UdpServer

type UdpServer struct {
	events.EventEmitter
	// contains filtered or unexported fields
}

UdpServer UDP服务器

func (*UdpServer) Close

func (server *UdpServer) Close() (err error)

Close 关闭

func (server *UdpServer) GetLink(id int64) Link

GetLink 获取链接

func (*UdpServer) Open

func (server *UdpServer) Open() error

Open 打开

func (*UdpServer) Running

func (server *UdpServer) Running() bool

Jump to

Keyboard shortcuts

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