model

package
v0.0.0-...-9835270 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0, MIT Imports: 6 Imported by: 0

README

message

内部消息结构

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnClosed      = errors.New("connection was closed")
	ErrRequestTimedOut = errors.New("request timed out")
	ErrUnknown         = errors.New("unknown error")
)

Functions

func GetVersionResp

func GetVersionResp() util.JSONResponse

Version returns the server version

Types

type ApiType

type ApiType int
const (
	API_HS  ApiType = 0
	API_FED ApiType = 1
)

type Command

type Command int
const (
	/**************roomserver api***************/
	CMD_HS Command = 1000 + iota
	CMD_HS_SEND
	CMD_HS_ROOM_ALIAS
	CMD_HS_PROFILE
	CMD_HS_AVATARURL
	CMD_HS_DISPLAYNAME
	CMD_HS_INVITE
	CMD_HS_MAKEJOIN
	CMD_HS_SENDJOIN
	CMD_HS_NOTARY_NOTICE
)

api 对应命令号,按段分配,从1000-9999

const (
	// PUT /_matrix/federation/v1/send/{txnId}
	CMD_FED Command = 6000 + iota
	CMD_FED_SEND
	CMD_FED_ROOM_DIRECTORY
	CMD_FED_PROFILE
	CMD_FED_AVATARURL
	CMD_FED_DISPLAYNAME
	CMD_FED_INVITE
	CMD_FED_MAKEJOIN
	CMD_FED_SENDJOIN
	CMD_FED_ROOM_STATE
	CMD_FED_BACKFILL
	CMD_FED_GET_MISSING_EVENTS
	CMD_FED_NOTARY_NOTICE
	CMD_FED_USER_INFO
	CMD_FED_MAKELEAVE
	CMD_FED_SENDLEAVE
	CMD_FED_EVENT
	CMD_FED_STATE_IDS
	CMD_FED_QUERY_AUTH
	CMD_FED_EVENT_AUTH
	CMD_FED_GET_PUBLIC_ROOMS
	CMD_FED_POST_PUBLIC_ROOMS
	CMD_FED_USER_DEVICES
	CMD_FED_CLIENT_KEYS
	CMD_FED_CLIENT_KEYS_CLAIM
	CMD_FED_EXCHANGE_THIRD_PARTY_INVITE
)

type ErrStr

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

type GobMessage

type GobMessage struct {
	Head
	Key []byte
	//Body Payload
	Body []byte
}

内部Gob格式消息体

type Head struct {
	// Err error  // gob didn't support enc/dec errors.errorString{}
	ErrStr string
	// 消息类型,包括请求,响应,推送三种类型
	MsgType MsgType
	// 消息序号
	MsgSeq string
	// 消息所属逻辑节点号
	NodeId int64
	// api类型
	ApiType ApiType
	// api接口功能号
	Cmd Command
}

type MsgType

type MsgType int
const (
	REQUEST MsgType = 1
	REPLY   MsgType = 2
	MESSAGE MsgType = 3
)

type Payload

type Payload interface{}

type Server

type Server struct {
	Version string `json:"version"`
	Name    string `json:"name"`
}

type TxnReq

type TxnReq struct {
	// Content	gomatrixserverlib.RawJSON
	Origin gomatrixserverlib.ServerName
	// gomatrixserverlib.Transaction
	Context context.Context
}

transaction request for federation

type Version

type Version struct {
	Server Server `json:"server"`
}

func GetVersion

func GetVersion() *Version

func (*Version) Decode

func (v *Version) Decode(input []byte) error

func (*Version) Encode

func (v *Version) Encode() ([]byte, error)

Directories

Path Synopsis
Package types provides the types that are used internally within the roomserver.
Package types provides the types that are used internally within the roomserver.
roomserverapi
Package api provides the types that are used to communicate with the roomserver.
Package api provides the types that are used to communicate with the roomserver.

Jump to

Keyboard shortcuts

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