github.com/verrazzano/verrazzano@v1.7.1/pkg/test/ip/fake_ip.go (about)

     1  // Copyright (c) 2022, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package ip
     5  
     6  import (
     7  	"crypto/rand"
     8  	"fmt"
     9  	"math/big"
    10  )
    11  
    12  func RandomIP() string {
    13  	n1, _ := rand.Int(rand.Reader, big.NewInt(256))
    14  	n2, _ := rand.Int(rand.Reader, big.NewInt(256))
    15  	n3, _ := rand.Int(rand.Reader, big.NewInt(256))
    16  	n4, _ := rand.Int(rand.Reader, big.NewInt(256))
    17  	return fmt.Sprintf("%d.%d.%d.%d", n1, n2, n3, n4)
    18  }