refactor: replace deprecated grpc.Dial with grpc.NewClient in code and docs
This commit is contained in:
@@ -33,13 +33,13 @@ func random(min, max int, src rand.Source) int {
|
||||
// return min + int(v.Uint64())
|
||||
// }
|
||||
|
||||
func getString(len int64) string {
|
||||
func getString(len int64, src rand.Source) string {
|
||||
temp := ""
|
||||
startChar := "!"
|
||||
var i int64 = 1
|
||||
for {
|
||||
// For getting valid ASCII characters
|
||||
myRand := random(0, 94, rand.NewSource(time.Now().UnixNano()))
|
||||
myRand := random(0, 94, src)
|
||||
newChar := string(startChar[0] + byte(myRand))
|
||||
temp = temp + newChar
|
||||
if i == len {
|
||||
@@ -75,8 +75,8 @@ func (IoTServer) UpdateSensingData(ctx context.Context, r *protoapi.SensingData)
|
||||
}
|
||||
|
||||
func (IoTServer) GetRandomPass(ctx context.Context, r *protoapi.RequestPass) (*protoapi.RandomPass, error) {
|
||||
rand.Seed(r.GetSeed())
|
||||
temp := getString(r.GetLength())
|
||||
src := rand.NewSource(r.GetSeed())
|
||||
temp := getString(r.GetLength(), src)
|
||||
|
||||
response := &protoapi.RandomPass{
|
||||
Password: temp,
|
||||
|
||||
Reference in New Issue
Block a user