msg

package
v0.0.0-...-449852d Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHAT_SERIALIZATION = "plaintext"
	CHAT_MESSAGE_TYPE  = "chat"
)
View Source
const REPLY_SERIALIZATION = "cbor"

Variables

View Source
var CHAT_CONTENT_TYPE_PARAMS = map[string]string{
	"type": CHAT_MESSAGE_TYPE,
}
View Source
var REPLY_CONTENT_TYPE_PARAMS = map[string]string{
	"type": "reply",
}

Functions

func Chat

func Chat(
	from string,
	to string,
	content []byte,
	priv_key ed25519.PrivateKey) (*msg.Message, error)

New creates a new Message instance

func NewReply

func NewReply(m msg.Message, reply []byte) ([]byte, error)

func Reply

func Reply(ctx context.Context, m msg.Message, replyBytes []byte, privKey ed25519.PrivateKey, topic *pubsub.Topic) error

Reply to a message. requires the message to create a reply containing the id of the requesting message The message is not a pointer, as we only need the ID and then throw it away.

Types

type ReplyContent

type ReplyContent struct {
	// Id of the messagew to reply to
	RequestID string `cbor:"requestID"`
	// Reply content
	Reply []byte `cbor:"reply"`
}

Jump to

Keyboard shortcuts

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