webrtc

package
v1.3.282 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DataChannelLabel = "ggcode-tunnel"

Variables

This section is empty.

Functions

func DataChannelConfig

func DataChannelConfig() *webrtc.DataChannelInit

func DefaultICEServers

func DefaultICEServers() []webrtc.ICEServer

func HostPeerFactory

func HostPeerFactory() tunnel.PeerFactory

func PeerConfig

func PeerConfig() webrtc.Configuration

Types

type DataChannelTransport

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

func NewDataChannelTransport

func NewDataChannelTransport(peer *Peer) *DataChannelTransport

func (*DataChannelTransport) Close

func (t *DataChannelTransport) Close() error

func (*DataChannelTransport) IsConnected

func (t *DataChannelTransport) IsConnected() bool

func (*DataChannelTransport) OnDisconnect

func (t *DataChannelTransport) OnDisconnect(handler func())

func (*DataChannelTransport) OnMessage

func (t *DataChannelTransport) OnMessage(handler func(data []byte))

func (*DataChannelTransport) Send

func (t *DataChannelTransport) Send(data []byte) error

type Peer

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

func NewPeer

func NewPeer() (*Peer, error)

func (*Peer) AddICECandidate

func (p *Peer) AddICECandidate(candidateStr string) error

func (*Peer) Close

func (p *Peer) Close() error

func (*Peer) CreateAnswer

func (p *Peer) CreateAnswer() (string, error)

func (*Peer) CreateOffer

func (p *Peer) CreateOffer() (string, error)

func (*Peer) IsReady

func (p *Peer) IsReady() bool

func (*Peer) OnDCOpen

func (p *Peer) OnDCOpen(fn func())

func (*Peer) OnDisconnect

func (p *Peer) OnDisconnect(fn func())

func (*Peer) OnICECandidate

func (p *Peer) OnICECandidate(fn func(candidate string))

func (*Peer) OnMessage

func (p *Peer) OnMessage(fn func(data []byte))

func (*Peer) Send

func (p *Peer) Send(data []byte) error

func (*Peer) SetRemoteAnswer

func (p *Peer) SetRemoteAnswer(sdp string) error

func (*Peer) SetRemoteOffer

func (p *Peer) SetRemoteOffer(sdp string) error

Jump to

Keyboard shortcuts

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