Help us shape the future of Go! Take the 2026 Go Developer Survey

pubmessage

package
v0.57.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidChannelID = errors.New("invalid or empty channel id on pubmessage")

ErrInvalidChannelID is returned for an invalid inner channel ID.

Functions

This section is empty.

Types

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message fulfills the Message type with a PubMessageInner.

func NewMessage

func NewMessage(peerID peer.ID, pktInner *PubMessageInner) *Message

NewMessage constructs a new Message object

func (*Message) GetAuthenticated

func (m *Message) GetAuthenticated() bool

GetAuthenticated indicates if the signature is valid.

func (*Message) GetData

func (m *Message) GetData() []byte

GetData returns the Message data.

func (*Message) GetFrom

func (m *Message) GetFrom() peer.ID

GetFrom returns the peer ID of the sender.

type PubMessageInner

type PubMessageInner struct {

	// Data is the message data.
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// Channel is the channel.
	Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
	// Timestamp is the message timestamp.
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

PubMessageInner is the signed inner portion of the message.

func ExtractAndVerify

func ExtractAndVerify(msg *peer.SignedMsg) (*PubMessageInner, crypto.PubKey, peer.ID, error)

ExtractAndVerify extracts the inner message from a signed message.

func NewPubMessage

func NewPubMessage(
	channelID string,
	privKey crypto.PrivKey,
	hashType hash.HashType,
	data []byte,
) (*peer.SignedMsg, *PubMessageInner, error)

NewPubMessage constructs/signs/encodes a new pub-message and inner message.

Uses time.Now() for the timestamp: not deterministic.

func (*PubMessageInner) CloneMessageVT

func (m *PubMessageInner) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PubMessageInner) CloneVT

func (m *PubMessageInner) CloneVT() *PubMessageInner

func (*PubMessageInner) EqualMessageVT

func (this *PubMessageInner) EqualMessageVT(thatMsg any) bool

func (*PubMessageInner) EqualVT

func (this *PubMessageInner) EqualVT(that *PubMessageInner) bool

func (*PubMessageInner) GetChannel

func (x *PubMessageInner) GetChannel() string

func (*PubMessageInner) GetData

func (x *PubMessageInner) GetData() []byte

func (*PubMessageInner) GetTimestamp

func (x *PubMessageInner) GetTimestamp() *timestamppb.Timestamp

func (*PubMessageInner) MarshalJSON

func (x *PubMessageInner) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PubMessageInner to JSON.

func (*PubMessageInner) MarshalProtoJSON

func (x *PubMessageInner) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PubMessageInner message to JSON.

func (*PubMessageInner) MarshalProtoText

func (x *PubMessageInner) MarshalProtoText() string

func (*PubMessageInner) MarshalToSizedBufferVT

func (m *PubMessageInner) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PubMessageInner) MarshalToVT

func (m *PubMessageInner) MarshalToVT(dAtA []byte) (int, error)

func (*PubMessageInner) MarshalVT

func (m *PubMessageInner) MarshalVT() (dAtA []byte, err error)

func (*PubMessageInner) ProtoMessage

func (*PubMessageInner) ProtoMessage()

func (*PubMessageInner) Reset

func (x *PubMessageInner) Reset()

func (*PubMessageInner) SizeVT

func (m *PubMessageInner) SizeVT() (n int)

func (*PubMessageInner) String

func (x *PubMessageInner) String() string

func (*PubMessageInner) UnmarshalJSON

func (x *PubMessageInner) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PubMessageInner from JSON.

func (*PubMessageInner) UnmarshalProtoJSON

func (x *PubMessageInner) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PubMessageInner message from JSON.

func (*PubMessageInner) UnmarshalVT

func (m *PubMessageInner) UnmarshalVT(dAtA []byte) error

func (*PubMessageInner) Validate

func (i *PubMessageInner) Validate() error

Validate checks the inner data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL