wol

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wol 实现网络唤醒模块:向局域网发送魔术包唤醒设备,并可通过 TCP 端口探测设备是否在线。

Index

Constants

View Source
const ID = "wol"

ID 是模块标识。

Variables

This section is empty.

Functions

func MagicPacket

func MagicPacket(mac string) ([]byte, error)

MagicPacket 生成魔术包:6 字节 0xFF 后跟 16 次 MAC。

func Wake

func Wake(d Device) (int, error)

Wake 发送魔术包,返回实际发送的目标数量。

Types

type Device

type Device struct {
	Key  string   `json:"key"`
	Name string   `json:"name"`
	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 是一台可唤醒的设备。

func (*Device) Validate

func (d *Device) Validate() error

Validate 校验设备配置。

type Module

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

Module 是网络唤醒模块。

func New

func New() *Module

New 创建模块。

func (*Module) ID

func (m *Module) ID() string

ID 实现 module.Module。

func (*Module) ImportLucky

func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)

ImportLucky 实现 luckyimport.Importer。

func (*Module) Init

func (m *Module) Init(env module.Env) error

Init 实现 module.Module。

func (*Module) Routes

func (m *Module) Routes(r module.Router)

Routes 实现 module.Module。

func (*Module) Start

func (m *Module) Start(context.Context) error

Start 实现 module.Module。

func (*Module) Stop

func (m *Module) Stop() error

Stop 实现 module.Module。

func (*Module) Title

func (m *Module) Title() string

Title 实现 module.Module。

Jump to

Keyboard shortcuts

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