Documentation
¶
Index ¶
- func LoadDevices(ctx context.Context) error
- func LoadProduct(ctx context.Context, id string) (*model.Product, error)
- func LoadServer(ctx context.Context, id int) error
- func LoadServers(ctx context.Context) error
- func LoadTunnel(ctx context.Context, id int) error
- func LoadTunnels(ctx context.Context) error
- func MapperDevice(res logicModel.DeviceOutput) model.Device
- func MapperServer(ctx context.Context, res logicModel.NetworkServerOut) model.Server
- func NewTunnel(tunnel *model.Tunnel) (tunnelinstance.TunnelInstance, error)
- func RemoveDevice(id uint64) error
- func RemoveServer(id int) error
- func RemoveTunnel(id int) error
- func ServerCloseAction(serverId int)
- func ServerOpenAction(serverId int)
- func ServerTunnelAction(ctx context.Context, serverId int, deviceKey string)
- func StartSubscriber(ctx context.Context) error
- func StrToPointInterfaceWithError(str string, a interface{}) error
- func StrToPointInterfaceWithoutError(ctx context.Context, str string, a interface{})
- func TunnelCloseAction(tunnelId int)
- func TunnelOfflineAction(ctx context.Context, serverId, tunnelId int)
- func TunnelOnlineAction(ctx context.Context, tunnelId int, deviceKey string)
- func TunnelOpenAction(tunnelId int)
- type Device
- type MessagePropertyReporter
- type Point
- type Poller
- type Server
- type ServerInstance
- type ServerTCP
- type ServerTcpTunnel
- func (l *ServerTcpTunnel) Ask(cmd []byte, timeout time.Duration) ([]byte, error)
- func (l *ServerTcpTunnel) Close() error
- func (l *ServerTcpTunnel) Online() bool
- func (l *ServerTcpTunnel) Open(ctx context.Context) error
- func (l *ServerTcpTunnel) Pipe(pipe io.ReadWriteCloser)
- func (l *ServerTcpTunnel) ReadData(ctx context.Context, deviceKey string, data []byte)
- func (l *ServerTcpTunnel) Running() bool
- func (l *ServerTcpTunnel) Write(data []byte) error
- type ServerUDP
- type ServerUdpTunnel
- func (l *ServerUdpTunnel) Ask(cmd []byte, timeout time.Duration) ([]byte, error)
- func (l *ServerUdpTunnel) Close() error
- func (l *ServerUdpTunnel) Online() bool
- func (l *ServerUdpTunnel) Open(ctx context.Context) error
- func (l *ServerUdpTunnel) Pipe(pipe io.ReadWriteCloser)
- func (l *ServerUdpTunnel) ReadData(ctx context.Context, deviceKey string, data []byte)
- func (l *ServerUdpTunnel) Running() bool
- func (l *ServerUdpTunnel) Write(data []byte) error
- type Tunnel
- type TunnelClient
- func (l *TunnelClient) Ask(cmd []byte, timeout time.Duration) ([]byte, error)
- func (client *TunnelClient) Close() error
- func (l *TunnelClient) Online() bool
- func (client *TunnelClient) Open(ctx context.Context) error
- func (l *TunnelClient) Pipe(pipe io.ReadWriteCloser)
- func (l *TunnelClient) ReadData(ctx context.Context, deviceKey string, data []byte)
- func (client *TunnelClient) Retry(ctx context.Context)
- func (l *TunnelClient) Running() bool
- func (l *TunnelClient) Write(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadDevices ¶
func LoadTunnels ¶
func MapperDevice ¶
func MapperDevice(res logicModel.DeviceOutput) model.Device
func MapperServer ¶
func MapperServer(ctx context.Context, res logicModel.NetworkServerOut) model.Server
todo 需要处理下心跳和注册包,需要考虑到客户端可能不支持心跳或者注册包
func NewTunnel ¶
func NewTunnel(tunnel *model.Tunnel) (tunnelinstance.TunnelInstance, error)
NewTunnel 创建通道
func RemoveDevice ¶
func RemoveServer ¶
func RemoveTunnel ¶
func ServerCloseAction ¶
func ServerCloseAction(serverId int)
func ServerOpenAction ¶
func ServerOpenAction(serverId int)
func ServerTunnelAction ¶
func StartSubscriber ¶
func TunnelCloseAction ¶
func TunnelCloseAction(tunnelId int)
func TunnelOfflineAction ¶
func TunnelOnlineAction ¶
func TunnelOpenAction ¶
func TunnelOpenAction(tunnelId int)
Types ¶
type Device ¶
type Device struct { model.Device events.EventEmitter Context map[string]interface{} // contains filtered or unexported fields }
Device 设备
func (*Device) BindTunnel ¶
type MessagePropertyReporter ¶
type MessagePropertyReporter struct {
// contains filtered or unexported fields
}
func (MessagePropertyReporter) DeviceDataHandle ¶
func (m MessagePropertyReporter) DeviceDataHandle()
type Server ¶
type Server struct { model.Server Instance ServerInstance }
type ServerInstance ¶
type ServerInstance interface { Open(ctx context.Context) error Close() error GetTunnel(id int) tunnelinstance.TunnelInstance RemoveTunnel(id int) Running() bool }
Server 通道
type ServerTCP ¶
type ServerTCP struct {
// contains filtered or unexported fields
}
func (*ServerTCP) GetTunnel ¶
func (server *ServerTCP) GetTunnel(id int) tunnelinstance.TunnelInstance
func (*ServerTCP) RemoveTunnel ¶
type ServerTcpTunnel ¶
type ServerTcpTunnel struct {
// contains filtered or unexported fields
}
ServerTcpTunnel 网络连接
func (*ServerTcpTunnel) Pipe ¶
func (l *ServerTcpTunnel) Pipe(pipe io.ReadWriteCloser)
type ServerUDP ¶
type ServerUDP struct {
// contains filtered or unexported fields
}
ServerUDP UDP服务器
func (*ServerUDP) GetTunnel ¶
func (server *ServerUDP) GetTunnel(id int) tunnelinstance.TunnelInstance
GetTunnel 获取链接
func (*ServerUDP) RemoveTunnel ¶
type ServerUdpTunnel ¶
type ServerUdpTunnel struct {
// contains filtered or unexported fields
}
ServerUdpTunnel UDP链接
func (*ServerUdpTunnel) Close ¶
func (l *ServerUdpTunnel) Close() error
func (*ServerUdpTunnel) Pipe ¶
func (l *ServerUdpTunnel) Pipe(pipe io.ReadWriteCloser)
type Tunnel ¶
type Tunnel struct {
Instance tunnelinstance.TunnelInstance
}
type TunnelClient ¶
type TunnelClient struct {
// contains filtered or unexported fields
}
TunnelClient 网络链接
func (*TunnelClient) Pipe ¶
func (l *TunnelClient) Pipe(pipe io.ReadWriteCloser)
func (*TunnelClient) Retry ¶
func (client *TunnelClient) Retry(ctx context.Context)
Source Files
¶
- common.go
- connect.go
- device-manager.go
- device.go
- mapper.go
- mqtt-databus.go
- mqtt-device-property-report.go
- mqtt-device-router.go
- mqtt-device.go
- point.go
- poller.go
- product-manager.go
- server-common.go
- server-manager.go
- server-tcp-tunnel.go
- server-tcp.go
- server-udp-tunnel.go
- server-udp.go
- server.go
- tunnel-base.go
- tunnel-client.go
- tunnel-common.go
- tunnel-manager.go
- tunnel.go
Click to show internal directories.
Click to hide internal directories.