diff --git a/controller/tunnel.go b/controller/tunnel.go index 6e5f179f..f1279dae 100644 --- a/controller/tunnel.go +++ b/controller/tunnel.go @@ -61,7 +61,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo logrus.Error(err) return tunnel.NewTunnelInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error())) } - svcName, err := randomId() + svcName, err := createServiceName() if err != nil { logrus.Error(err) return tunnel.NewTunnelInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error())) diff --git a/controller/util.go b/controller/util.go index d149b677..a85e0124 100644 --- a/controller/util.go +++ b/controller/util.go @@ -46,10 +46,10 @@ func createToken() string { return shortuuid.New() } -func randomId() (string, error) { - bytes := make([]byte, 8) +func createServiceName() (string, error) { + bytes := make([]byte, 4) if _, err := rand.Read(bytes); err != nil { - return "", errors.Wrap(err, "error generating random identity id") + return "", errors.Wrap(err, "error generating service name") } return hex.EncodeToString(bytes), nil }