Browse Source

Merge pull request #2006 from gravitl/GRA-1136/rm_pinger

rm unused pinger func
dcarns 2 years ago
parent
commit
d412287aed
1 changed files with 0 additions and 28 deletions
  1. 0 28
      metrics/metrics.go

+ 0 - 28
metrics/metrics.go

@@ -1,12 +1,9 @@
 package metrics
 package metrics
 
 
 import (
 import (
-	"fmt"
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
-	"github.com/go-ping/ping"
-	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/models"
 	"github.com/gravitl/netmaker/models"
 )
 )
 
 
@@ -84,28 +81,3 @@ func ResetMetricForNode(server, peerKey, peerID string) {
 
 
 // MetricCollectionInterval - collection interval for metrics
 // MetricCollectionInterval - collection interval for metrics
 const MetricCollectionInterval = time.Second * 25
 const MetricCollectionInterval = time.Second * 25
-
-// PeerConnectionStatus - get peer connection status by pinging
-func PeerConnectionStatus(address string) (connected bool) {
-	fmt.Println("PINGER ADDR: ", address)
-	pinger, err := ping.NewPinger(address)
-	if err != nil {
-		logger.Log(0, "could not initiliaze ping peer address", address, err.Error())
-		connected = false
-	} else {
-		pinger.Timeout = time.Second * 2
-		err = pinger.Run()
-		if err != nil {
-			logger.Log(0, "failed to ping on peer address", address, err.Error())
-			return false
-		} else {
-			pingStats := pinger.Statistics()
-			if pingStats.PacketsRecv > 0 {
-				connected = true
-				return
-			}
-		}
-	}
-
-	return
-}