mirror of
https://github.com/XZB-1248/Spark
synced 2025-09-26 20:21:11 +08:00

add: zmodem(lrzsz) support for terminal add: update notification (won't auto update) optimize: protocol of terminal and desktop optimize: experience of explorer optimize: github workflow remove: CryptoJS
29 lines
685 B
Go
29 lines
685 B
Go
package terminal
|
|
|
|
import (
|
|
"Spark/utils/cmap"
|
|
"errors"
|
|
)
|
|
|
|
var terminals = cmap.New()
|
|
var (
|
|
errDataNotFound = errors.New(`no input found in packet`)
|
|
errDataInvalid = errors.New(`can not parse data in packet`)
|
|
errUUIDNotFound = errors.New(`can not find terminal identifier`)
|
|
)
|
|
|
|
// packet explanation:
|
|
|
|
// +---------+---------+----------+-------------+------+
|
|
// | magic | op code | event id | data length | data |
|
|
// +---------+---------+----------+-------------+------+
|
|
// | 5 bytes | 1 byte | 16 bytes | 2 bytes | - |
|
|
// +---------+---------+----------+-------------+------+
|
|
|
|
// magic:
|
|
// []byte{34, 22, 19, 17, 21}
|
|
|
|
// op code:
|
|
// 00: binary packet
|
|
// 01: JSON packet
|