proto

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 10 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// client to ion
	ClientJoin        = "join"
	ClientLeave       = "leave"
	ClientPublish     = "publish"
	ClientUnPublish   = "unpublish"
	ClientSubscribe   = "subscribe"
	ClientUnSubscribe = "unsubscribe"
	ClientBroadcast   = "broadcast"
	ClientTrickle     = "trickle"
	ClientOffer       = "offer"
	ClientAnswer      = "answer"

	// ion to client
	ClientOnJoin         = "peer-join"
	ClientOnLeave        = "peer-leave"
	ClientOnList         = "peer-list"
	ClientOnStreamAdd    = "stream-add"
	ClientOnStreamRemove = "stream-remove"
	ClientOnOffer        = "offer"
	ClientOnAnswer       = "answer"

	// ion to islb
	IslbFindNode = "find-node"
	IslbRelay    = "relay"
	IslbUnrelay  = "unRelay"

	IslbKeepAlive = "keepAlive"
	IslbPeerJoin  = ClientOnJoin
	IslbPeerLeave = ClientOnLeave
	IslbStreamAdd = ClientOnStreamAdd
	IslbBroadcast = ClientBroadcast

	// SFU Endpoints
	SfuTrickleICE    = ClientTrickle
	SfuClientJoin    = ClientJoin
	SfuClientOffer   = ClientOnOffer
	SfuClientAnswer  = ClientOnAnswer
	SfuClientTrickle = ClientTrickle
	SfuClientLeave   = ClientLeave

	// avp
	AvpProcess = "avp-process"

	IslbID = "islb"
)

Variables

This section is empty.

Functions

func CandidateForJSON added in v1.5.0

func CandidateForJSON(c webrtc.ICECandidateInit) webrtc.ICECandidateInit

CandidateForJSON for json.Marshal() => browser

func GetPubMediaPath

func GetPubMediaPath(rid, mid string, ssrc uint32) string

func GetPubMediaPathKey

func GetPubMediaPathKey(rid string) string

func GetPubNodePath

func GetPubNodePath(rid, uid string) string

func Marshal added in v1.5.0

func Marshal(v interface{}) ([]byte, error)

Marshal encodes v and returns encoded data

func MarshalNodeField added in v0.2.0

func MarshalNodeField(node NodeInfo) (string, string, error)

func MarshalTrackField added in v0.2.0

func MarshalTrackField(id string, infos []TrackInfo) (string, string, error)

func Unmarshal added in v1.5.0

func Unmarshal(data []byte, v interface{}) error

Unmarshal parses the encoded data and stores the result in the value pointed to by v

func UnmarshalTrackField added in v0.2.0

func UnmarshalTrackField(key string, value string) (string, *[]TrackInfo, error)

Types

type Authenticatable added in v1.5.0

type Authenticatable interface {
	Room() RID
	Token() string
}

type ClientAnswerMsg added in v1.5.0

type ClientAnswerMsg struct {
	Desc webrtc.SessionDescription `json:"desc"`
}

type ClientOfferMsg added in v1.5.0

type ClientOfferMsg struct {
	Desc webrtc.SessionDescription `json:"desc"`
}

type ClientTrickleMsg added in v1.5.0

type ClientTrickleMsg struct {
	Candidate webrtc.ICECandidateInit `json:"candidate"`
	Target    int                     `json:"target"`
}

type FromClientBroadcastMsg added in v1.5.0

type FromClientBroadcastMsg struct {
	RID  RID             `json:"rid"`
	Info json.RawMessage `json:"info"`
}

type FromClientJoinMsg added in v1.5.0

type FromClientJoinMsg struct {
	RID   RID                       `json:"sid"`
	Offer webrtc.SessionDescription `json:"offer"`
	RoomToken
	Info json.RawMessage `json:"info"`
}

func (*FromClientJoinMsg) Room added in v1.5.0

func (j *FromClientJoinMsg) Room() RID

func (*FromClientJoinMsg) Token added in v1.5.0

func (j *FromClientJoinMsg) Token() string

type FromClientLeaveMsg added in v1.5.0

type FromClientLeaveMsg struct {
	RID RID `json:"rid"`
}

type FromIslbFindNodeMsg added in v1.5.0

type FromIslbFindNodeMsg struct {
	ID string
}

type FromIslbListMids added in v1.5.0

type FromIslbListMids struct {
	MIDs []MID `json:"mids"`
}

type FromIslbPeerJoinMsg added in v1.5.0

type FromIslbPeerJoinMsg struct {
	Peers   []Peer   `json:"peers"`
	Streams []Stream `json:"streams"`
}

type FromIslbStreamAddMsg added in v1.5.0

type FromIslbStreamAddMsg struct {
	UID    UID    `json:"uid"`
	RID    RID    `json:"rid"`
	Stream Stream `json:"stream"`
}

type FromSfuJoinMsg added in v1.5.0

type FromSfuJoinMsg struct {
	Answer webrtc.SessionDescription `json:"answer"`
}

type IslbBroadcastMsg added in v1.5.0

type IslbBroadcastMsg struct {
	RoomInfo
	Info json.RawMessage `json:"info"`
}

type IslbPeerLeaveMsg added in v1.5.0

type IslbPeerLeaveMsg struct {
	RoomInfo
}

type MID added in v0.4.5

type MID string

type MediaInfo added in v0.2.0

type MediaInfo struct {
	// DC data center id
	DC string `json:"dc,omitempty"`
	// NID node id
	NID string `json:"nid,omitempty"`
	// RID room id
	RID RID `json:"rid,omitempty"`
	// UID user id
	UID UID `json:"uid,omitempty"`
	// MID media id
	MID MID `json:"mid,omitempty"`
}

MediaInfo media detailed information dc/${nid}/${rid}/${uid}/media/pub/${mid} node1 origin node2 shadow msid [{ssrc: 1234, pt: 111, type:audio}] msid [{ssrc: 5678, pt: 96, type:video}]

func ParseMediaInfo added in v0.2.0

func ParseMediaInfo(key string) (*MediaInfo, error)

Parse dc1/sfu-tU2GInE5Lfuc/7485294b-9815-4888-83a5-631e77445b67/room1/media/pub/7e97c1e8-c80a-4c69-81b0-27efc83e6120

func (MediaInfo) BuildKey added in v0.3.5

func (m MediaInfo) BuildKey() string

type MsgHandler added in v1.5.0

type MsgHandler func(msg interface{}) (interface{}, error)

MsgHandler is a callback function that processes messages delivered to asynchronous subscribers.

type NatsRPC added in v1.5.0

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

NatsRPC represents a rpc base nats

func NewNatsRPC added in v1.5.0

func NewNatsRPC(urls string) (*NatsRPC, error)

NewNatsRPC create a instanse and connect to nats server.

func (*NatsRPC) Close added in v1.5.0

func (r *NatsRPC) Close()

Close the connection to the server.

func (*NatsRPC) Connect added in v1.5.0

func (r *NatsRPC) Connect(url string) error

Connect to nats server.

func (*NatsRPC) Publish added in v1.5.0

func (r *NatsRPC) Publish(subj string, data interface{}) error

Publish publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver.

func (*NatsRPC) QueueSubscribe added in v1.5.0

func (r *NatsRPC) QueueSubscribe(subj, queue string, handle MsgHandler) (*nats.Subscription, error)

QueueSubscribe creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously.

func (*NatsRPC) Request added in v1.5.0

func (r *NatsRPC) Request(subj string, data interface{}) (interface{}, error)

Request will send a request payload and deliver the response message, or an error, including a timeout if no message was received properly.

func (*NatsRPC) Subscribe added in v1.5.0

func (r *NatsRPC) Subscribe(subj string, handle MsgHandler) (*nats.Subscription, error)

Subscribe will express interest in the given subject. Messages will be delivered to the associated MsgHandler.

type NodeInfo added in v0.2.0

type NodeInfo struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	Type string `json:"type"` // origin | shadow
}

func UnmarshalNodeField added in v0.2.0

func UnmarshalNodeField(key string, value string) (*NodeInfo, error)

type Peer added in v1.5.0

type Peer struct {
	UID  UID             `json:"uid"`
	Info json.RawMessage `json:"info"`
}

type RID added in v0.4.5

type RID string

type RPCError added in v1.5.0

type RPCError struct {
	Err string
}

RPCError represents a error string for rpc

type RoomInfo added in v0.3.5

type RoomInfo struct {
	RID RID `json:"rid"`
	UID UID `json:"uid"`
}

type RoomToken added in v1.5.0

type RoomToken struct {
	Token string `json:"token,omitempty"`
}

type SfuAnswerMsg added in v1.5.0

type SfuAnswerMsg struct {
	MID  MID                       `json:"mid"`
	Desc webrtc.SessionDescription `json:"answer"`
}

type SfuICEConnectionStateMsg added in v1.5.2

type SfuICEConnectionStateMsg struct {
	MID   MID                       `json:"mid"`
	State webrtc.ICEConnectionState `json:"state"`
}

type SfuOfferMsg added in v1.5.0

type SfuOfferMsg struct {
	MID  MID                       `json:"mid"`
	Desc webrtc.SessionDescription `json:"offer"`
}

type SfuTrickleMsg added in v1.5.0

type SfuTrickleMsg struct {
	MID       MID                     `json:"mid"`
	Candidate webrtc.ICECandidateInit `json:"candidate"`
	Target    int                     `json:"target"`
}

type Stream added in v1.5.0

type Stream struct {
	StreamID StreamID `json:"streamId"`
	UID      UID      `json:"uid"`
}

type StreamID added in v1.5.0

type StreamID string

type ToAvpProcessMsg added in v1.5.0

type ToAvpProcessMsg struct {
	Addr   string `json:"Addr"`
	PID    string `json:"pid"`
	RID    string `json:"rid"`
	TID    string `json:"tid"`
	EID    string `json:"eid"`
	Config []byte `json:"config"`
}

ToAvpProcessMsg .

type ToClientBroadcastMsg added in v1.5.0

type ToClientBroadcastMsg struct {
	RoomInfo
	Info json.RawMessage `json:"info"`
}

type ToClientJoinMsg added in v1.5.0

type ToClientJoinMsg struct {
	Answer webrtc.SessionDescription `json:"answer"`
}

type ToClientPeerJoinMsg added in v1.5.0

type ToClientPeerJoinMsg struct {
	UID  UID             `json:"uid"`
	RID  RID             `json:"rid"`
	Info json.RawMessage `json:"info"`
}

type ToClientPeersMsg added in v1.5.0

type ToClientPeersMsg struct {
	Peers   []Peer   `json:"peers"`
	Streams []Stream `json:"streams"`
}

type ToIslbFindNodeMsg added in v1.5.0

type ToIslbFindNodeMsg struct {
	Service string
	UID     UID `json:"uid"`
	RID     RID `json:"rid"`
	MID     MID `json:"mid"`
}

type ToIslbPeerJoinMsg added in v1.5.0

type ToIslbPeerJoinMsg struct {
	UID  UID             `json:"uid"`
	RID  RID             `json:"rid"`
	MID  MID             `json:"mid"`
	Info json.RawMessage `json:"info"`
}

type ToIslbStreamAddMsg added in v1.5.0

type ToIslbStreamAddMsg struct {
	UID      UID      `json:"uid"`
	RID      RID      `json:"rid"`
	MID      MID      `json:"mid"`
	StreamID StreamID `json:"streamId"`
}

type ToSfuJoinMsg added in v1.5.0

type ToSfuJoinMsg struct {
	RID   RID                       `json:"rid"`
	MID   MID                       `json:"mid"`
	Offer webrtc.SessionDescription `json:"offer"`
}

type ToSfuLeaveMsg added in v1.5.0

type ToSfuLeaveMsg struct {
	MID MID `json:"mid"`
}

type TrackInfo added in v0.2.0

type TrackInfo struct {
	ID      string `json:"id"`
	Ssrc    int    `json:"ssrc"`
	Payload int    `json:"pt"`
	Type    string `json:"type"`
	Codec   string `json:"codec"`
	Fmtp    string `json:"fmtp"`
}

type TrackMap added in v0.3.5

type TrackMap map[string][]TrackInfo

type UID added in v0.4.5

type UID string

type UserInfo added in v0.2.0

type UserInfo struct {
	DC  string
	RID RID
	UID UID
}

func ParseUserInfo added in v0.2.0

func ParseUserInfo(key string) (*UserInfo, error)

func (UserInfo) BuildKey added in v0.3.5

func (u UserInfo) BuildKey() string

Jump to

Keyboard shortcuts

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