Esempio n. 1
0
func (job *Job) encode() {
	if job.cmd == "" {
		return // no command to encode
	}
	c, err := encrypt.NewCrypto()
	if err != nil {
		panic(err)
	}
	hash, err := c.Encrypt(job.cmd)
	if err != nil {
		panic(err)
	}
	job.hash = hash
}
Esempio n. 2
0
func (job *Job) decode() {
	if job.hash == "" {
		return
	}
	c, err := encrypt.NewCrypto()
	if err != nil {
		panic(err)
	}
	cmd, err := c.Decrypt(job.hash)
	if err != nil {
		panic(err)
	}
	job.cmd = cmd
	switch job.flag {
	case 0:
		job.status = "wait"
	case 1:
		job.status = "*run"
	case 2:
		job.status = "done"
	default:
		job.status = "eror"
	}
}