github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/testaddr_random.go (about) 1 // Copyright 2016 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // +build linux 12 13 package util 14 15 import ( 16 "fmt" 17 18 "github.com/cockroachdb/cockroach/pkg/util/randutil" 19 ) 20 21 func init() { 22 r, _ := randutil.NewPseudoRand() 23 // 127.255.255.255 is special (broadcast), so choose values less 24 // than 255. 25 a := r.Intn(255) 26 b := r.Intn(255) 27 c := r.Intn(255) 28 IsolatedTestAddr = NewUnresolvedAddr("tcp", fmt.Sprintf("127.%d.%d.%d:0", a, b, c)) 29 }