Fix err on empty IFACES

This commit is contained in:
aceberg 2024-09-04 22:34:09 +07:00
parent 246b35dbaf
commit 936d4aa312
3 changed files with 16 additions and 7 deletions

View file

@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.
## [v2.0.2] - 2024-09-
### Fixed
- Error when `IFACES`=""
## [v2.0.1] - 2024-09-02
### Added
- `Vlans` and `docker0` support [#47](https://github.com/aceberg/WatchYourLAN/issues/47). Thanks [thehijacker](https://github.com/thehijacker)!

View file

@ -7,7 +7,8 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/WatchYourLAN)](https://goreportcard.com/report/github.com/aceberg/WatchYourLAN)
[![Maintainability](https://api.codeclimate.com/v1/badges/46b17f99edc1726b5d7d/maintainability)](https://codeclimate.com/github/aceberg/WatchYourLAN/maintainability)
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/aceberg/watchyourlan)
![Docker Pulls](https://img.shields.io/docker/pulls/aceberg/watchyourlan)
![GitHub Discussions](https://img.shields.io/github/discussions/aceberg/WatchYourLAN)
Lightweight network IP scanner with web GUI. Features:
- Send notification when new host is found

View file

@ -68,17 +68,21 @@ func parseOutput(text, iface string) []models.Host {
// Scan all interfaces
func Scan(ifaces, args string, strs []string) []models.Host {
var text string
var p []string
var foundHosts = []models.Host{}
arpArgs = args
p := strings.Split(ifaces, " ")
if ifaces != "" {
for _, iface := range p {
slog.Debug("Scanning interface " + iface)
text = scanIface(iface)
slog.Debug("Found IPs: \n" + text)
p = strings.Split(ifaces, " ")
foundHosts = append(foundHosts, parseOutput(text, iface)...)
for _, iface := range p {
slog.Debug("Scanning interface " + iface)
text = scanIface(iface)
slog.Debug("Found IPs: \n" + text)
foundHosts = append(foundHosts, parseOutput(text, iface)...)
}
}
for _, s := range strs {