misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-03-18 12:23:55 +01:00
commit ba4793f980
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 39 additions and 48 deletions

View file

@ -1,7 +1,6 @@
package session
import (
"encoding/json"
"errors"
"fmt"
"net"
@ -45,32 +44,6 @@ var (
type UnknownCommandCallback func(cmd string) bool
type ModuleList []Module
type JSONModule struct {
Name string `json:"name"`
Description string `json:"description"`
Author string `json:"author"`
Parameters map[string]*ModuleParam `json:"parameters"`
Handlers []ModuleHandler `json:"handlers"`
Running bool `json:"running"`
}
func (mm ModuleList) MarshalJSON() ([]byte, error) {
mods := []JSONModule{}
for _, m := range mm {
mods = append(mods, JSONModule{
Name: m.Name(),
Description: m.Description(),
Author: m.Author(),
Parameters: m.Parameters(),
Handlers: m.Handlers(),
Running: m.Running(),
})
}
return json.Marshal(mods)
}
type GPS struct {
Latitude float64 // Latitude.
Longitude float64 // Longitude.