Documentation
¶
Overview ¶
Package wol 实现网络唤醒模块:向局域网发送魔术包唤醒设备,并可通过 TCP 端口探测设备是否在线。
Index ¶
- Constants
- func MagicPacket(mac string) ([]byte, error)
- func Wake(d Device) (int, error)
- type Device
- type Module
- func (m *Module) ID() string
- func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
- func (m *Module) Init(env module.Env) error
- func (m *Module) Routes(r module.Router)
- func (m *Module) Start(context.Context) error
- func (m *Module) Stop() error
- func (m *Module) Title() string
Constants ¶
View Source
const ID = "wol"
ID 是模块标识。
Variables ¶
This section is empty.
Functions ¶
func MagicPacket ¶
MagicPacket 生成魔术包:6 字节 0xFF 后跟 16 次 MAC。
Types ¶
type Device ¶
type Device struct {
Key string `json:"key"`
Name string `json:"name"`
// Group 为列表中的分组名称,只影响管理界面的展示,留空为未分组
Group string `json:"group"`
MACs []string `json:"macs"`
// BroadcastIPs 为空时向 255.255.255.255 及各网卡广播地址发送
BroadcastIPs []string `json:"broadcastIps"`
Port int `json:"port"`
Repeat int `json:"repeat"`
// CheckAddr 为 host:port,用于探测设备是否在线(例如 192.168.1.10:3389),留空不探测
CheckAddr string `json:"checkAddr"`
Remark string `json:"remark"`
// Enable 为了复用通用接口保留,网络唤醒设备始终可用
Enable bool `json:"enable"`
}
Device 是一台可唤醒的设备。
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module 是网络唤醒模块。
func (*Module) ImportLucky ¶
func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
ImportLucky 实现 luckyimport.Importer。
Click to show internal directories.
Click to hide internal directories.