uploadinterface should be used for pings

This commit is contained in:
2022-07-15 17:39:00 +02:00
parent da8c726b2e
commit b431cd6428

View File

@@ -31,7 +31,6 @@ type Conf struct {
UploadInterface string `yaml:"upload_interface"`
ThrottlePingThreshold int64 `yaml:"throttle_ping_threshold"`
TryRestoringAfter int `yaml:"try_restoring_after"`
PingInterface string `yaml:"ping_interface"`
}
var (
@@ -85,7 +84,7 @@ func doPing(host string, count int, interval time.Duration) (*ping.Statistics, e
pinger.Interval = interval
// get interface
nif, err := net.InterfaceByName(conf.PingInterface)
nif, err := net.InterfaceByName(conf.UploadInterface)
if err != nil {
return nil, err
}
@@ -94,7 +93,7 @@ func doPing(host string, count int, interval time.Duration) (*ping.Statistics, e
return nil, err
}
if len(addr) == 0 {
return nil, fmt.Errorf("interface %s has no addressed assigned", conf.PingInterface)
return nil, fmt.Errorf("interface %s has no addressed assigned", conf.UploadInterface)
}
pinger.Source = addr[0].(*net.IPNet).IP.String()