Documentation ¶
Index ¶
- Constants
- Variables
- func AddTask(id string, tks *time.Timer)
- func CutID(id string) (string, string)
- func GenerateID() string
- func GetCodec(codec *string) string
- func GetInterval() int
- func GetModeType(codec string) string
- func GetRepeerGaptime() int
- func MergeID(clientID string, peerID string) string
- func NewSDPType(raw string) webrtc.SDPType
- func RandomInt(min, max int) int
- func RemoveTask(id string)
- func ToByte(data interface{}) ([]byte, error)
- func ToJSON(data []byte, des interface{}) error
- func ToString(data interface{}) (string, error)
- type Action
- type AdvanceMap
- func (a *AdvanceMap) Capture() map[string]interface{}
- func (a *AdvanceMap) Delete(key interface{})
- func (a *AdvanceMap) Get(key string) (interface{}, bool)
- func (a *AdvanceMap) GetKeys() []string
- func (a *AdvanceMap) Geti(key interface{}) (interface{}, bool)
- func (a *AdvanceMap) Iter(callBack func(key, value interface{}) bool)
- func (a *AdvanceMap) Len() int64
- func (a *AdvanceMap) Set(key string, value interface{})
- func (a *AdvanceMap) Seti(key, value interface{})
- func (a *AdvanceMap) ToMap() map[string]interface{}
- type Client
- type ClientDataTime
- type Forwarder
- func (f *Forwarder) AddClient(clientID *string, client *Client)
- func (f *Forwarder) Close()
- func (f *Forwarder) Hub(wrapper *Wrapper)
- func (f *Forwarder) Push(wrapper *Wrapper)
- func (f *Forwarder) Register(clientID *string, handler func(trackID string, wrapper *Wrapper) error)
- func (f *Forwarder) RemoveClient(clientID *string)
- func (f *Forwarder) UnRegister(clientID *string)
- type ForwarderMannager
- func (f *ForwarderMannager) AddNewForwarder(fwdID string) *Forwarder
- func (f *ForwarderMannager) Close()
- func (f *ForwarderMannager) GetClient(trackID, pcID *string) chan *Wrapper
- func (f *ForwarderMannager) GetForwarder(id string) *Forwarder
- func (f *ForwarderMannager) GetKeys() []string
- func (f *ForwarderMannager) GetLastTimeReceive() map[string]int64
- func (f *ForwarderMannager) GetLastTimeReceiveBy(trackID string) int64
- func (f *ForwarderMannager) Push(id string, wrapper *Wrapper)
- func (f *ForwarderMannager) Register(trackID string, clientID string, ...)
- func (f *ForwarderMannager) RegisterAll(clientID string, handler func(trackID string, wrapper *Wrapper) error)
- func (f *ForwarderMannager) RemoveForwarder(id string)
- func (f *ForwarderMannager) Unregister(trackID, pcID *string)
- func (f *ForwarderMannager) UnregisterAll(peerConnectionID string)
- type Fwdm
- type FwdmAction
- type Log
- type SDPParser
- type SDPTemp
- type TaskTimer
- type TurnConfig
- type TurnConfigList
- type TurnRequestBody
- type Wrapper
Constants ¶
const ( // MimeTypeH264 H264 MIME type. // Note: Matching should be case insensitive. MimeTypeH264 = "video/H264" // MimeTypeOpus Opus MIME type // Note: Matching should be case insensitive. MimeTypeOpus = "audio/opus" // MimeTypeVP8 VP8 MIME type // Note: Matching should be case insensitive. MimeTypeVP8 = "video/VP8" // MimeTypeVP9 VP9 MIME type // Note: Matching should be case insensitive. MimeTypeVP9 = "video/VP9" // MimeTypeG722 G722 MIME type // Note: Matching should be case insensitive. MimeTypeG722 = "audio/G722" // MimeTypePCMU PCMU MIME type // Note: Matching should be case insensitive. MimeTypePCMU = "audio/PCMU" // MimeTypePCMA PCMA MIME type // Note: Matching should be case insensitive. MimeTypePCMA = "audio/PCMA" )
const ( Connected = "connected" Failed = "failed" Closed = "closed" Disconnected = "disconnected" )
ice state
const ( // ModeAll linter ModeAll = "all" // ModeVP8 liner ModeVP8 = "vp8" // ModeVP9 linter ModeVP9 = "vp9" // ModeH264 linter ModeH264 = "h264" // ModeOpus linter ModeOpus = "opus" )
Mediaenine mode
const ( // SplitStr linter SplitStr = "-" // NodeType linter NodeType = "pn" // PeerUp linter PeerUp = "up" // PeerDown linter PeerDown = "down" // PeerNodeType linter PeerNodeType = "peer_node" // MemberType linter MemberType = "member" )
Peer Role
const ( // SampleTrackType linter SampleTrackType = "sample" // RTPTrackType linter RTPTrackType = "rtp" )
const MaxBufferSize = 1000 * 2048 // 1MB
MaxBufferSize The maximum amount of data that can be buffered before returning errors.
const MaxMTU = 1460 // 1MB
MaxMTU linter
Variables ¶
var ( // DefaultCodecVP8 linter DefaultCodecVP8 = "VP8" // DefaultCodecVP9 linter DefaultCodecVP9 = "VP9" // DefaultPayloadVP8 linter DefaultPayloadVP8 = 96 // DefaultPayloadVP9 linter DefaultPayloadVP9 = 98 )
var ( // DEBUG to logging debug DEBUG = os.Getenv("DEBUG") // TIMEOUT linter TIMEOUT = os.Getenv("TIMEOUT") )
Functions ¶
func NewSDPType ¶
func NewSDPType(raw string) webrtc.SDPType
NewSDPType format sdp type between pion and javascript
Types ¶
type AdvanceMap ¶
type AdvanceMap struct {
// contains filtered or unexported fields
}
AdvanceMap wrap around sync map in go
func (*AdvanceMap) Capture ¶
func (a *AdvanceMap) Capture() map[string]interface{}
Capture a current map Warning: Current data will be delete after using it
func (*AdvanceMap) Get ¶
func (a *AdvanceMap) Get(key string) (interface{}, bool)
Get get item with key string
func (*AdvanceMap) Geti ¶
func (a *AdvanceMap) Geti(key interface{}) (interface{}, bool)
Geti get item with key interface
func (*AdvanceMap) Iter ¶
func (a *AdvanceMap) Iter(callBack func(key, value interface{}) bool)
Iter go though a map
func (*AdvanceMap) Set ¶
func (a *AdvanceMap) Set(key string, value interface{})
Set set string key with interface value
func (*AdvanceMap) Seti ¶
func (a *AdvanceMap) Seti(key, value interface{})
Seti set interface key with interface value
func (*AdvanceMap) ToMap ¶
func (a *AdvanceMap) ToMap() map[string]interface{}
ToMap returning map to this value
type ClientDataTime ¶
type ClientDataTime struct {
// contains filtered or unexported fields
}
ClientDataTime linter
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder linter
func NewForwarder ¶
func NewForwarder(id string, dataTimeChann chan *ClientDataTime) *Forwarder
NewForwarder return new forwarder
func (*Forwarder) Register ¶
func (f *Forwarder) Register(clientID *string, handler func(trackID string, wrapper *Wrapper) error)
Register linter
func (*Forwarder) RemoveClient ¶
RemoveClient linter
type ForwarderMannager ¶
type ForwarderMannager struct {
// contains filtered or unexported fields
}
ForwarderMannager control all forwadrder manager
func (*ForwarderMannager) AddNewForwarder ¶
func (f *ForwarderMannager) AddNewForwarder(fwdID string) *Forwarder
AddNewForwarder linter
func (*ForwarderMannager) GetClient ¶
func (f *ForwarderMannager) GetClient(trackID, pcID *string) chan *Wrapper
GetClient linter
func (*ForwarderMannager) GetForwarder ¶
func (f *ForwarderMannager) GetForwarder(id string) *Forwarder
GetForwarder get forwarder of this id is exist or not
func (*ForwarderMannager) GetKeys ¶
func (f *ForwarderMannager) GetKeys() []string
GetKeys return id of all forwarder
func (*ForwarderMannager) GetLastTimeReceive ¶
func (f *ForwarderMannager) GetLastTimeReceive() map[string]int64
GetLastTimeReceive linter
func (*ForwarderMannager) GetLastTimeReceiveBy ¶
func (f *ForwarderMannager) GetLastTimeReceiveBy(trackID string) int64
GetLastTimeReceiveBy linter
func (*ForwarderMannager) Push ¶
func (f *ForwarderMannager) Push(id string, wrapper *Wrapper)
Push to wrapper to specific id
func (*ForwarderMannager) Register ¶
func (f *ForwarderMannager) Register(trackID string, clientID string, handler func(trackID string, wrapper *Wrapper) error)
Register regis a client id to specific forwarder
func (*ForwarderMannager) RegisterAll ¶ added in v0.1.0
func (f *ForwarderMannager) RegisterAll(clientID string, handler func(trackID string, wrapper *Wrapper) error)
func (*ForwarderMannager) RemoveForwarder ¶
func (f *ForwarderMannager) RemoveForwarder(id string)
RemoveForwarder remove forwader with id
func (*ForwarderMannager) Unregister ¶
func (f *ForwarderMannager) Unregister(trackID, pcID *string)
Unregister unregis clientId to specific forwarder
func (*ForwarderMannager) UnregisterAll ¶
func (f *ForwarderMannager) UnregisterAll(peerConnectionID string)
UnregisterAll linter
type Fwdm ¶
type Fwdm interface { UnregisterAll(peerConnectionID string) // unregister of fwd with input peer connection id RegisterAll(clientID string, handler func(trackID string, wrapper *Wrapper) error) Register(fwdID string, clientID string, handler func(trackID string, wrapper *Wrapper) error) Unregister(trackID, pcID *string) AddNewForwarder(id string) *Forwarder RemoveForwarder(id string) GetForwarder(id string) *Forwarder Push(id string, wrapper *Wrapper) GetKeys() []string Close() GetClient(trackID, pcID *string) chan *Wrapper GetLastTimeReceive() map[string]int64 GetLastTimeReceiveBy(trackID string) int64 }
Fwdm linter
func NewForwarderMannager ¶
NewForwarderMannager create audio or video forwader
type FwdmAction ¶
type FwdmAction struct { Action // contains filtered or unexported fields }
FwdmAction linter
type Log ¶ added in v0.0.5
type Log interface { ERROR(msg string, tags map[string]any) INFO(msg string, tags map[string]any) WARN(msg string, tags map[string]any) DEBUG(msg string, tags map[string]any) STACK(msg ...string) }
Log default method
type SDPParser ¶
type SDPParser struct {
// contains filtered or unexported fields
}
SDPParser linter
func (*SDPParser) GetArrPayLoadType ¶
GetArrPayLoadType return a list of input sdp payload input sdp data
type TaskTimer ¶
type TaskTimer struct {
// contains filtered or unexported fields
}
TaskTimer linter
type TurnConfig ¶
type TurnConfig struct { URLs string `json:"urls"` Username string `json:"username"` Password string `json:"password"` }
TurnConfig handle foreach turn config in list
type TurnConfigList ¶
type TurnConfigList struct { Success bool `json:"success"` Message string `json:"message"` Data []TurnConfig `json:"data"` }
TurnConfigList get resp body
type TurnRequestBody ¶
type TurnRequestBody struct { CallType string `json:"callType"` RequestID string `json:"requestID"` }
TurnRequestBody linter
type Wrapper ¶
type Wrapper struct { Duration time.Duration Pkg *rtp.Packet // save rtp packet Data []byte `json:"rtp"` // packet to write Kind *string `json:"kind"` // audio or video SeatID *int `json:"seatID"` // stream id number 1-2-3-4 Type *string `json:"type"` // type off wrapper data - ok - ping - pong }
Wrapper linter