MCPcopy
hub / github.com/1Panel-dev/KubePi / GenTerminalSessionId

Function GenTerminalSessionId

pkg/terminal/shell.go:265–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263}
264
265func GenTerminalSessionId() (string, error) {
266 bytes := make([]byte, 16)
267 if _, err := rand.Read(bytes); err != nil {
268 return "", err
269 }
270 id := make([]byte, hex.EncodedLen(len(bytes)))
271 hex.Encode(id, bytes)
272 return string(id), nil
273}
274
275// isValidShell checks if the shell is an allowed one
276func isValidShell(validShells []string, shell string) bool {

Callers 2

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected