types

package
v0.0.0-...-bed19f8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPeerId = errors.New("invalid peer id")
	ErrInvalidCallId = errors.New("invalid call id")
	ErrInvalidMethod = errors.New("invalid method")
)
View Source
var (
	RequestUnmarshalErrorResponse = &CallResponse{
		CallId: "",
		Method: "",
		Status: codes.InvalidArgument,
		Data:   nil,
	}
	PeerOfflineResponseError = errors.New("peer offline")
	CallTimeoutResponseError = errors.New("call timeout")
)

Functions

This section is empty.

Types

type CallRequest

type CallRequest struct {
	//对端id
	PeerId string `json:"peerId"`
	//请求id
	CallId string `json:"callId"`
	//请求方法
	Method string `json:"method"`
	//请求携带的数据
	Data []byte `json:"data"`
}

func (*CallRequest) FromBytes

func (r *CallRequest) FromBytes(data []byte) error

func (*CallRequest) ToBytes

func (r *CallRequest) ToBytes() []byte

func (*CallRequest) Validate

func (r *CallRequest) Validate() error

type CallResponse

type CallResponse struct {
	//请求id
	CallId string `json:"callId"`
	//请求方法
	Method string `json:"method"`
	//响应状态
	Status codes.Code `json:"status"`
	//响应携带的数据
	Data []byte `json:"data"`
}

func CallTimeoutResponse

func CallTimeoutResponse(callId string, method string) *CallResponse

func PeerOfflineResponse

func PeerOfflineResponse(callId string, method string) *CallResponse

func (*CallResponse) FromBytes

func (r *CallResponse) FromBytes(msg []byte) error

func (*CallResponse) ToBytes

func (r *CallResponse) ToBytes() []byte

type PeerConnection

type PeerConnection struct {
	PeerId              string
	WenSocketConnection *websocket.Conn
	Headers             map[string]string
	Ctx                 context.Context
	ConnectedAt         time.Time
	RemoteIp            string
	ClientIp            string
}

Jump to

Keyboard shortcuts

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