go-gun/gun/message.go

28 lines
742 B
Go
Raw Normal View History

2019-02-22 09:23:14 +00:00
package gun
import "encoding/json"
2019-02-22 09:23:14 +00:00
type Message struct {
Ack string `json:"@,omitempty"`
ID string `json:"#,omitempty"`
To string `json:"><,omitempty"`
Hash json.Number `json:"##,omitempty"`
2019-02-22 09:23:14 +00:00
How string `json:"how,omitempty"`
Get *MessageGetRequest `json:"get,omitempty"`
Put map[string]*Node `json:"put,omitempty"`
DAM string `json:"dam,omitempty"`
PID string `json:"pid,omitempty"`
2019-02-25 04:23:15 +00:00
OK int `json:"ok,omitempty"`
Err string `json:"err,omitempty"`
2019-02-22 09:23:14 +00:00
}
type MessageGetRequest struct {
Soul string `json:"#,omitempty"`
Field string `json:".,omitempty"`
}
type MessageReceived struct {
*Message
2019-02-25 05:14:26 +00:00
Peer *Peer
2019-02-22 09:23:14 +00:00
}