2024-08-23 10:50:14 +00:00
|
|
|
package hyper
|
|
|
|
|
|
|
|
import jsoniter "github.com/json-iterator/go"
|
|
|
|
|
|
|
|
type NetworkPackage struct {
|
|
|
|
Action string `json:"w"`
|
|
|
|
Endpoint string `json:"e,omitempty"`
|
2024-08-23 11:33:02 +00:00
|
|
|
Message string `json:"m,omitempty"`
|
2024-08-23 10:50:14 +00:00
|
|
|
Payload any `json:"p"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v NetworkPackage) Marshal() []byte {
|
|
|
|
data, _ := jsoniter.Marshal(v)
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v NetworkPackage) RawPayload() []byte {
|
|
|
|
out, _ := jsoniter.Marshal(v.Payload)
|
|
|
|
return out
|
|
|
|
}
|