p2pcommon

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertClientError

func ConvertClientError(recv *p2ppb.Envelope) error

ConvertClientError converts Envelope to error

func ConvertP2PEnvelopeToError

func ConvertP2PEnvelopeToError(p2pEnvelope *protocolpb.P2PEnvelope) error

ConvertP2PEnvelopeToError converts p2pEnvelope containing an error to Error

func ExtractDID

func ExtractDID(id protocol.ID) (identity.DID, error)

ExtractDID extracts DID from a protocol string

func PrepareP2PEnvelope

func PrepareP2PEnvelope(ctx context.Context, networkID uint32, messageType MessageType, mes proto.Message) (*protocolpb.P2PEnvelope, error)

PrepareP2PEnvelope wraps content message into p2p envelope

func ProtocolForDID

func ProtocolForDID(did identity.DID) protocol.ID

ProtocolForDID creates the protocol string for the given CID

func ResolveDataEnvelope

func ResolveDataEnvelope(mes proto.Message) (*p2ppb.Envelope, error)

ResolveDataEnvelope unwraps Content Envelope out of p2pEnvelope

Types

type MessageType

type MessageType string

MessageType holds the protocol message type

const (
	// CentrifugeProtocol is the centrifuge wire protocol
	CentrifugeProtocol protocol.ID = "/centrifuge/0.0.1"

	// MessageTypeError defines any protocol error
	MessageTypeError MessageType = "MessageTypeError"
	// MessageTypeInvalid defines invalid protocol type
	MessageTypeInvalid MessageType = "MessageTypeInvalid"
	// MessageTypeRequestSignature defines RequestSignature type
	MessageTypeRequestSignature MessageType = "MessageTypeRequestSignature"
	// MessageTypeRequestSignatureRep defines RequestSignature response type
	MessageTypeRequestSignatureRep MessageType = "MessageTypeRequestSignatureRep"
	// MessageTypeSendAnchoredDoc defines SendAnchored type
	MessageTypeSendAnchoredDoc MessageType = "MessageTypeSendAnchoredDoc"
	// MessageTypeSendAnchoredDocRep defines SendAnchored response type
	MessageTypeSendAnchoredDocRep MessageType = "MessageTypeSendAnchoredDocRep"
	//MessageTypeGetDoc defines GetAnchoredDoc type
	MessageTypeGetDoc MessageType = "MessageTypeGetDoc"
	//MessageTypeGetDocRep defines GetAnchoredDoc response type
	MessageTypeGetDocRep MessageType = "MessageTypeGetDocRep"
)

func MessageTypeFromString

func MessageTypeFromString(ht string) MessageType

MessageTypeFromString Resolves MessageType out of string

func (MessageType) Equals

func (mt MessageType) Equals(mt2 string) bool

Equals compares if string is of a particular MessageType

func (MessageType) String

func (mt MessageType) String() string

String representation

Jump to

Keyboard shortcuts

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