2019-02-22 09:23:14 +00:00
|
|
|
package gun
|
|
|
|
|
2019-02-22 19:51:50 +00:00
|
|
|
import "encoding/json"
|
|
|
|
|
2019-02-22 09:23:14 +00:00
|
|
|
type Message struct {
|
2019-02-22 19:51:50 +00:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2019-02-25 22:28:19 +00:00
|
|
|
type messageReceived struct {
|
2019-02-22 09:23:14 +00:00
|
|
|
*Message
|
2019-02-25 22:28:19 +00:00
|
|
|
|
|
|
|
peer *Peer
|
|
|
|
stored bool
|
2019-02-22 09:23:14 +00:00
|
|
|
}
|