Browse Source

fix logging vebosity by deleting more comms functions

Matthew R. Kasun 3 years ago
parent
commit
799f7f040c
1 changed files with 0 additions and 36 deletions
  1. 0 36
      servercfg/serverconf.go

+ 0 - 36
servercfg/serverconf.go

@@ -2,18 +2,13 @@ package servercfg
 
 import (
 	"errors"
-	"fmt"
 	"io"
-	"math/rand"
-	"net"
 	"net/http"
 	"os"
 	"strconv"
 	"strings"
-	"time"
 
 	"github.com/gravitl/netmaker/config"
-	"github.com/gravitl/netmaker/logger"
 )
 
 var (
@@ -562,34 +557,3 @@ func GetRce() bool {
 func GetDebug() bool {
 	return os.Getenv("DEBUG") == "on" || config.Config.Server.Debug == true
 }
-
-func genNewCommsCIDR() string {
-	currIfaces, err := net.Interfaces()
-	netrange := fmt.Sprintf("172.%d.0.0/16", genCommsByte())
-	if err == nil { // make sure chosen CIDR doesn't overlap with any local iface CIDRs
-		iter := 0
-		for i := 0; i < len(currIfaces); i++ {
-			if currentAddrs, err := currIfaces[i].Addrs(); err == nil {
-				for j := range currentAddrs {
-					if strings.Contains(currentAddrs[j].String(), netrange[0:7]) {
-						if iter > 20 { // if this hits, then the cidr should be specified
-							logger.FatalLog("could not find a suitable comms network on this server, please manually enter one")
-						}
-						netrange = fmt.Sprintf("172.%d.0.0/16", genCommsByte())
-						i = -1 // reset to loop back through
-						iter++ // track how many times you've iterated and not found one
-						break
-					}
-				}
-			}
-		}
-	}
-	return netrange
-}
-
-func genCommsByte() int {
-	const min = 1 << 4 // 16
-	const max = 1 << 5 // 32
-	rand.Seed(time.Now().UnixNano())
-	return rand.Intn(max-min) + min
-}