new: aliases are now centralized and can be used for any type of device (closes #504)

This commit is contained in:
evilsocket 2019-03-21 19:39:08 +01:00
commit 7e7f2ef645
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
11 changed files with 115 additions and 51 deletions

View file

@ -42,6 +42,7 @@ type HIDDevice struct {
sync.Mutex
LastSeen time.Time
Type HIDType
Alias string
Address string
RawAddress []byte
channels map[int]bool
@ -53,6 +54,7 @@ type hidDeviceJSON struct {
LastSeen time.Time `json:"last_seen"`
Type string `json:"type"`
Address string `json:"address"`
Alias string `json:"alias"`
Channels []string `json:"channels"`
Payloads []string `json:"payloads"`
PayloadsSize uint64 `json:"payloads_size"`
@ -102,6 +104,7 @@ func (dev *HIDDevice) MarshalJSON() ([]byte, error) {
LastSeen: dev.LastSeen,
Type: dev.Type.String(),
Address: dev.Address,
Alias: dev.Alias,
Channels: dev.channelsListUnlocked(),
Payloads: make([]string, 0),
PayloadsSize: dev.payloadsSz,