creating messages library, will be encoding/decoding via encoding/JSON for now

This commit is contained in:
2020-06-01 14:38:17 -04:00
parent 1a76a8f2aa
commit 33b1c78eb2
9 changed files with 80 additions and 19 deletions

7
messages/go.mod Normal file
View File

@@ -0,0 +1,7 @@
module github.com/deranjer/gvc/messages
go 1.14
replace derajnet.duckdns.org/git/deranjer/gvc => ../gvc //alias for local development
replace github.com/deranjer/gvc => ../gvc

28
messages/structure.go Normal file
View File

@@ -0,0 +1,28 @@
package messages
// ID forces the command IDs to always be a certain type.
type ID int
// ID forces all these commands to be locked in
const (
COMMIT ID = iota
REFRESH
INFO
PUSH
PULL
REVERT
LOCK
)
// Modifiers contains any arguments/modifiers to the command ID
type Modifiers struct {
ModifierID string
ModifierData string
}
// Command is the structure that all messages must adhere to
type Command struct {
CmdID ID //locked into the ID type
Mods []Modifiers
Body []byte
}