scan

package
v0.0.0-...-e3618f4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MIoTMdnsServiceType 小米设备的 mDNS 服务类型
	MIoTMdnsServiceType = "_miot-central._tcp.local."
	// MIoTMdnsTimeout mDNS 扫描超时时间
	MIoTMdnsTimeout = 30 * time.Second
)
View Source
const (
	// MIoTUDPort 小米设备的 UDP 端口
	MIoTUDPort = 54321
	// MIoTProbeLen 探测包长度
	MIoTProbeLen = 32
	// MIoTProbeInterval 探测间隔
	MIoTProbeInterval = 5 * time.Second
	// MIoTTimeout 超时时间
	MIoTTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	DID string `json:"did"`
	IP  string `json:"ip"`
}

Device 表示发现的小米设备

func (*Device) String

func (d *Device) String() string

String 返回设备的字符串表示

type MDnsScanner

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

MDnsScanner 用于通过 mDNS 发现小米设备

func NewMDnsScanner

func NewMDnsScanner() *MDnsScanner

NewMDnsScanner 创建一个新的 mDNS 扫描器

func (*MDnsScanner) Found

func (s *MDnsScanner) Found() <-chan *Device

Found 返回发现设备的通道

func (*MDnsScanner) Start

func (s *MDnsScanner) Start() error

Start 开始扫描

func (*MDnsScanner) Stop

func (s *MDnsScanner) Stop()

Stop 停止扫描

type UDPScanner

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

UDPScanner 用于通过 UDP 广播发现小米设备

func NewUDPScanner

func NewUDPScanner(localDID string) *UDPScanner

NewUDPScanner 创建一个新的 UDP 扫描器

func (*UDPScanner) Found

func (s *UDPScanner) Found() <-chan *Device

Found 返回发现设备的通道

func (*UDPScanner) Start

func (s *UDPScanner) Start() error

Start 开始扫描

func (*UDPScanner) Stop

func (s *UDPScanner) Stop()

Stop 停止扫描

Source Files

  • device.go
  • mdns.go
  • udp.go

Jump to

Keyboard shortcuts

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