swebrtc

package
v0.0.0-...-f1241d1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MulanPSL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandString

func RandString(length int) string

Types

type Entry

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

func (*Entry) SetIP

func (e *Entry) SetIP(addr string)

type ICEServer

type ICEServer struct {
	URL        string `json:"url"`
	Credential string `json:"credential"`
	Username   string `json:"username"`
}

type TurnServer

type TurnServer struct {
	Svr *turn.Server
	// contains filtered or unexported fields
}

turnserver服务

func NewServer

func NewServer(port int, publicIP string, realm string) (*TurnServer, error)

func NewTurnServer

func NewTurnServer(realm string) *TurnServer

func (*TurnServer) Authenticate

func (a *TurnServer) Authenticate(username, realm string, addr net.Addr) ([]byte, bool)

func (*TurnServer) Credentials

func (a *TurnServer) Credentials(username string) (string, string)

func (*TurnServer) Disallow

func (a *TurnServer) Disallow(username string)

type Webrtc

type Webrtc struct {
	PeerConnection *webrtc.PeerConnection `json:"peerConnection"`
	DataChannel    *webrtc.DataChannel    `json:"dataChannel"`
	// contains filtered or unexported fields
}

func NewWebrtc

func NewWebrtc(ICEServers []ICEServer, sender bool) *Webrtc

func (*Webrtc) Close

func (w *Webrtc) Close()

关闭所有

func (*Webrtc) OnConnectionStateChange

func (w *Webrtc) OnConnectionStateChange(f func(s webrtc.PeerConnectionState))

监听状态变化

func (*Webrtc) OnDataChannel

func (w *Webrtc) OnDataChannel(c *webrtc.DataChannel)

监听Data管道

func (*Webrtc) OnICECandidate

func (w *Webrtc) OnICECandidate(f func(c *webrtc.ICECandidate))

监听ICE变化

func (*Webrtc) Savecandidate

func (w *Webrtc) Savecandidate(candidate webrtc.ICECandidateInit) error

func (*Webrtc) SendAnswer

func (w *Webrtc) SendAnswer(sdp *webrtc.SessionDescription) *webrtc.SessionDescription

func (*Webrtc) SendOffer

func (w *Webrtc) SendOffer() *webrtc.SessionDescription

开启

Jump to

Keyboard shortcuts

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