f084135701
ICMP requires root or CAP_NET_RAW which is not available in unprivileged containers. Probe now relies solely on port scanning for reachability detection, which works without any special permissions. Add port 51826 (HomeKit) to both default and database-loaded port lists.
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package probe
|
|
|
|
type Response struct {
|
|
IP string `json:"ip"`
|
|
Reachable bool `json:"reachable"`
|
|
Type string `json:"type"` // "unreachable", "standard", "homekit"
|
|
Error string `json:"error,omitempty"`
|
|
Probes Probes `json:"probes"`
|
|
}
|
|
|
|
type Probes struct {
|
|
Ports *PortsResult `json:"ports"`
|
|
DNS *DNSResult `json:"dns"`
|
|
ARP *ARPResult `json:"arp"`
|
|
MDNS *MDNSResult `json:"mdns"`
|
|
HTTP *HTTPResult `json:"http"`
|
|
}
|
|
|
|
type PortsResult struct {
|
|
Open []int `json:"open"`
|
|
}
|
|
|
|
type DNSResult struct {
|
|
Hostname string `json:"hostname"`
|
|
}
|
|
|
|
type ARPResult struct {
|
|
MAC string `json:"mac"`
|
|
Vendor string `json:"vendor"`
|
|
}
|
|
|
|
type MDNSResult struct {
|
|
Name string `json:"name"`
|
|
DeviceID string `json:"device_id"`
|
|
Model string `json:"model"`
|
|
Category string `json:"category"` // "camera", "doorbell"
|
|
Paired bool `json:"paired"`
|
|
Port int `json:"port"`
|
|
}
|
|
|
|
type HTTPResult struct {
|
|
Port int `json:"port"`
|
|
StatusCode int `json:"status_code"`
|
|
Server string `json:"server"`
|
|
}
|