uploadinterface should be used for pings
This commit is contained in:
5
main.go
5
main.go
@@ -31,7 +31,6 @@ type Conf struct {
|
|||||||
UploadInterface string `yaml:"upload_interface"`
|
UploadInterface string `yaml:"upload_interface"`
|
||||||
ThrottlePingThreshold int64 `yaml:"throttle_ping_threshold"`
|
ThrottlePingThreshold int64 `yaml:"throttle_ping_threshold"`
|
||||||
TryRestoringAfter int `yaml:"try_restoring_after"`
|
TryRestoringAfter int `yaml:"try_restoring_after"`
|
||||||
PingInterface string `yaml:"ping_interface"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -85,7 +84,7 @@ func doPing(host string, count int, interval time.Duration) (*ping.Statistics, e
|
|||||||
pinger.Interval = interval
|
pinger.Interval = interval
|
||||||
|
|
||||||
// get interface
|
// get interface
|
||||||
nif, err := net.InterfaceByName(conf.PingInterface)
|
nif, err := net.InterfaceByName(conf.UploadInterface)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -94,7 +93,7 @@ func doPing(host string, count int, interval time.Duration) (*ping.Statistics, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(addr) == 0 {
|
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()
|
pinger.Source = addr[0].(*net.IPNet).IP.String()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user