common

package
v0.0.0-...-270fe73 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InviteApi                    = "/api/v1/invitation"
	ConnectRequestApi            = "/api/v1/connectionrequest"
	ConnectResponseApi           = "/api/v1/connectionresponse"
	ConnectAckApi                = "/api/v1/connectionack"
	SendDisconnectApi            = "/api/v1/senddisconnect"
	DisconnectApi                = "/api/v1/disconnect"
	SendProposalCredentialReqApi = "/api/v1/sendproposalcredential"
	ProposalCredentialReqApi     = "/api/v1/proposalcredential"
	OfferCredentialApi           = "/api/v1/offercredential"
	SendRequestCredentialApi     = "/api/v1/sendrequestcredential"
	RequestCredentialApi         = "/api/v1/requestcredential"
	IssueCredentialApi           = "/api/v1/issuecredentail"
	CredentialAckApi             = "/api/v1/credentialack"
	DeleteCredentialApi          = "/api/v1/deletecredential"
	QueryCredentialApi           = "/api/v1/querycredential"
	SendRequestPresentationApi   = "/api/v1/sendrequestpresentation"
	RequestPresentationApi       = "/api/v1/requestpresentation"
	PresentationProofApi         = "/api/v1/presentproof"
	PresentationAckApi           = "/api/v1/presentationack"
	QueryPresentationApi         = "/api/v1/querypresentation"
	DeletePresentationApi        = "/api/v1/deletepresentation"
	SendBasicMsgApi              = "/api/v1/sendbasicmsg"
	ReceiveBasicMsgApi           = "/api/v1/receivebasicmsg"
	QueryBasicMsgApi             = "/api/v1/querybasicmsg"
	QueryConnectionsApi          = "/api/v1/queryconnections"
)

Variables

View Source
var (
	EnablePackage bool
)

Functions

func GetApiName

func GetApiName(msgType MessageType) string

func IsReceiver

func IsReceiver(did string, routers []string) bool

func MergeRouter

func MergeRouter(myRouters, theirRouters []string) []string

func ParseConnectionMsg

func ParseConnectionMsg(c *gin.Context, packager *ecdsa.Packager) (*message.Connection, *packager.MessageData, error)

func ParseMessage

func ParseMessage(enablePackage bool, ctx *gin.Context, packager *ecdsa.Packager, messageType MessageType, msgSvr *MsgService) (interface{}, bool, error)

func ReverseConnection

func ReverseConnection(conn message.Connection) message.Connection

func RouterLastIndexOf

func RouterLastIndexOf(did string, routers []string) (int, error)

Types

type Gin

type Gin struct {
	C *gin.Context
}

func (*Gin) Response

func (g *Gin) Response(httpCode, errCode int, msg string, data interface{})

Response setting gin.JSON

type Message

type Message struct {
	MessageType `json:"type"`
	Content     interface{} `json:"content"`
}

type MessageType

type MessageType int
const (
	InvitationType MessageType = iota
	ConnectionRequestType
	ConnectionResponseType
	ConnectionAckType
	SendDisconnectType
	DisconnectType

	SendProposalCredentialType
	ProposalCredentialType
	OfferCredentialType
	SendRequestCredentialType
	RequestCredentialType
	IssueCredentialType
	CredentialAckType
	DeleteCredentialType
	QueryCredentialType

	SendRequestPresentationType
	RequestPresentationType
	PresentationType
	PresentationAckType
	DeletePresentationType
	QueryPresentationType

	SendBasicMsgType
	ReceiveBasicMsgType
	QueryBasicMessageType
	QueryConnectionsType
)

func TransferForwardMsgType

func TransferForwardMsgType(msgType MessageType) MessageType

type MsgService

type MsgService struct {
	Cfg *config.Cfg
	// contains filtered or unexported fields
}

MsgService is basic message service implementation

func NewMessageService

func NewMessageService(v vdri.VDRI, ontSdk *sdk.OntologySdk, acct *sdk.Account, enableEnvelop bool, conf *config.Cfg) *MsgService

func (*MsgService) GetNextRouter

func (m *MsgService) GetNextRouter(routers []string) (string, error)

func (*MsgService) GetServiceURL

func (m *MsgService) GetServiceURL(msg OutboundMsg) (string, error)

func (*MsgService) GetServiceURLByRouter

func (m *MsgService) GetServiceURLByRouter(router string, msgType MessageType) (string, error)

func (*MsgService) HandleOutBound

func (m *MsgService) HandleOutBound(omsg OutboundMsg) error

func (*MsgService) NeedForwardMsg

func (m *MsgService) NeedForwardMsg(router string, routers []string) bool

func (*MsgService) SendMsg

func (m *MsgService) SendMsg(msg OutboundMsg)

type OutboundMsg

type OutboundMsg struct {
	Msg       Message
	Conn      message.Connection
	IsForward bool
}

type Response

type Response struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc func(*gin.Context)
}

type Router

type Router interface {
	Routes() Routes
}

type Routes

type Routes []Route

Jump to

Keyboard shortcuts

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