creating messages library, will be encoding/decoding via encoding/JSON for now
This commit is contained in:
7
messages/go.mod
Normal file
7
messages/go.mod
Normal 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
28
messages/structure.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user