mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 14:50:55 +01:00
service name refactoring (#59)
This commit is contained in:
parent
366f7db982
commit
54b4161045
@ -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()))
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user