2017-06-13 12:49:07 +03:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
package whisperv5
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
)
|
|
|
|
|
2017-08-08 14:48:06 +03:00
|
|
|
var _ = (*newMessageOverride)(nil)
|
|
|
|
|
2017-06-13 12:49:07 +03:00
|
|
|
func (n NewMessage) MarshalJSON() ([]byte, error) {
|
|
|
|
type NewMessage struct {
|
|
|
|
SymKeyID string `json:"symKeyID"`
|
|
|
|
PublicKey hexutil.Bytes `json:"pubKey"`
|
|
|
|
Sig string `json:"sig"`
|
|
|
|
TTL uint32 `json:"ttl"`
|
|
|
|
Topic TopicType `json:"topic"`
|
|
|
|
Payload hexutil.Bytes `json:"payload"`
|
|
|
|
Padding hexutil.Bytes `json:"padding"`
|
|
|
|
PowTime uint32 `json:"powTime"`
|
|
|
|
PowTarget float64 `json:"powTarget"`
|
|
|
|
TargetPeer string `json:"targetPeer"`
|
|
|
|
}
|
|
|
|
var enc NewMessage
|
|
|
|
enc.SymKeyID = n.SymKeyID
|
|
|
|
enc.PublicKey = n.PublicKey
|
|
|
|
enc.Sig = n.Sig
|
|
|
|
enc.TTL = n.TTL
|
|
|
|
enc.Topic = n.Topic
|
|
|
|
enc.Payload = n.Payload
|
|
|
|
enc.Padding = n.Padding
|
|
|
|
enc.PowTime = n.PowTime
|
|
|
|
enc.PowTarget = n.PowTarget
|
|
|
|
enc.TargetPeer = n.TargetPeer
|
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *NewMessage) UnmarshalJSON(input []byte) error {
|
|
|
|
type NewMessage struct {
|
2018-01-08 16:13:22 +03:00
|
|
|
SymKeyID *string `json:"symKeyID"`
|
|
|
|
PublicKey *hexutil.Bytes `json:"pubKey"`
|
|
|
|
Sig *string `json:"sig"`
|
|
|
|
TTL *uint32 `json:"ttl"`
|
|
|
|
Topic *TopicType `json:"topic"`
|
|
|
|
Payload *hexutil.Bytes `json:"payload"`
|
|
|
|
Padding *hexutil.Bytes `json:"padding"`
|
|
|
|
PowTime *uint32 `json:"powTime"`
|
|
|
|
PowTarget *float64 `json:"powTarget"`
|
|
|
|
TargetPeer *string `json:"targetPeer"`
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
var dec NewMessage
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.SymKeyID != nil {
|
|
|
|
n.SymKeyID = *dec.SymKeyID
|
|
|
|
}
|
|
|
|
if dec.PublicKey != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
n.PublicKey = *dec.PublicKey
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.Sig != nil {
|
|
|
|
n.Sig = *dec.Sig
|
|
|
|
}
|
|
|
|
if dec.TTL != nil {
|
|
|
|
n.TTL = *dec.TTL
|
|
|
|
}
|
|
|
|
if dec.Topic != nil {
|
|
|
|
n.Topic = *dec.Topic
|
|
|
|
}
|
|
|
|
if dec.Payload != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
n.Payload = *dec.Payload
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.Padding != nil {
|
2018-01-08 16:13:22 +03:00
|
|
|
n.Padding = *dec.Padding
|
2017-06-13 12:49:07 +03:00
|
|
|
}
|
|
|
|
if dec.PowTime != nil {
|
|
|
|
n.PowTime = *dec.PowTime
|
|
|
|
}
|
|
|
|
if dec.PowTarget != nil {
|
|
|
|
n.PowTarget = *dec.PowTarget
|
|
|
|
}
|
|
|
|
if dec.TargetPeer != nil {
|
|
|
|
n.TargetPeer = *dec.TargetPeer
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|