Documentation ¶
Index ¶
- func GoCopy(src, dst io.ReadWriteCloser) error
- func GoFunc(ctx context.Context, f func(ctx context.Context) error)
- type ChanStatus
- type Channel
- func (c *Channel) Close() error
- func (c *Channel) Label() *Label
- func (c *Channel) LocalAddr() net.Addr
- func (c *Channel) OnMessage(msg webrtc.DataChannelMessage)
- func (c *Channel) Read(data []byte) (n int, err error)
- func (c *Channel) Release()
- func (c *Channel) RemoteAddr() net.Addr
- func (c *Channel) TakeConn() bool
- func (c *Channel) Write(data []byte) (int, error)
- type ChannelPool
- type ChannelReader
- type ChannelType
- type ClientAddr
- type ClientId
- type ClientPeer
- type ClusterName
- type Command
- type DataChannelCommand
- type Label
- type Peer
- func (p *Peer) Close() error
- func (p *Peer) Connect(ctx context.Context) error
- func (p *Peer) IsClose() bool
- func (p *Peer) Listen(ctx context.Context) error
- func (p *Peer) OnConnectionStateChange(pcs webrtc.PeerConnectionState)
- func (p *Peer) PollOffer(ctx context.Context) error
- func (p *Peer) SendAnswer(ctx context.Context) error
- func (p *Peer) SendOffer(ctx context.Context) error
- func (p *Peer) WaitAnswer(ctx context.Context) error
- type PeerId
- type ReadWriterReleaser
- type ServerAddr
- type Session
- type SigStatus
- type Signalinger
- type WsBackendSigClient
- type WsFrontendSigClient
- type WsSigClient
- func (c *WsSigClient) Close(ctx context.Context) error
- func (c *WsSigClient) CloseSession(id string)
- func (c *WsSigClient) GetSession(id string) *Session
- func (c *WsSigClient) Id() string
- func (c *WsSigClient) IsClose() bool
- func (c *WsSigClient) RemoteIceCandidates(id string) chan *webrtc.ICECandidate
- func (c *WsSigClient) RemoteSdp(id string) chan webrtc.SessionDescription
- func (c *WsSigClient) Run(ctx context.Context) error
- func (c *WsSigClient) SendPacket(ctx context.Context, p proto.Packet) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoCopy ¶
func GoCopy(src, dst io.ReadWriteCloser) error
Types ¶
type ChanStatus ¶
type ChanStatus string
const ( Opening ChanStatus = "opening" Idle ChanStatus = "idle" Active ChanStatus = "active" Closed ChanStatus = "closed" )
type Channel ¶
type Channel struct { Type webrtc.SDPType // contains filtered or unexported fields }
func NewAnswerChannel ¶
func NewAnswerChannel(sname, cid string, dc *webrtc.DataChannel, label *Label, accept, release chan ReadWriterReleaser) *Channel
func NewOfferChannel ¶
func NewOfferChannel(sname, cid string, dc *webrtc.DataChannel, label *Label, release chan ReadWriterReleaser) *Channel
func (*Channel) RemoteAddr ¶
type ChannelPool ¶
type ChannelPool struct { sync.RWMutex Type webrtc.SDPType Id string RemoteId string RemoteClientId string // contains filtered or unexported fields }
func NewChannelPool ¶
func NewChannelPool(pc *webrtc.PeerConnection, rid, rcid string, pt webrtc.SDPType) *ChannelPool
func (*ChannelPool) Close ¶
func (p *ChannelPool) Close() error
func (*ChannelPool) Get ¶
func (p *ChannelPool) Get(ct ChannelType, labels ...string) (ch ReadWriterReleaser, err error)
func (*ChannelPool) OnChannelOpen ¶
func (p *ChannelPool) OnChannelOpen(dc *webrtc.DataChannel) error
func (*ChannelPool) OnRelease ¶
func (p *ChannelPool) OnRelease(label string)
type ChannelReader ¶
type ChannelReader struct {
// contains filtered or unexported fields
}
func NewChannelReader ¶
func NewChannelReader(batchSize int) *ChannelReader
func (*ChannelReader) OnData ¶
func (r *ChannelReader) OnData(data []byte)
func (*ChannelReader) Release ¶
func (c *ChannelReader) Release()
type ChannelType ¶
type ChannelType string
const ( Keepalive ChannelType = "keepalive" Cmd ChannelType = "command" Web ChannelType = "web" Proxy ChannelType = "proxy" Ssh ChannelType = "ssh" File ChannelType = "file" )
func (ChannelType) String ¶
func (t ChannelType) String() string
type ClientAddr ¶
func NewClientAddr ¶
func NewClientAddr(clientId string, label *Label) *ClientAddr
func (*ClientAddr) Network ¶
func (a *ClientAddr) Network() string
func (*ClientAddr) String ¶
func (a *ClientAddr) String() string
type ClientPeer ¶
type ClusterName ¶
type ClusterName string
type DataChannelCommand ¶
type Label ¶
type Label struct { ChannelType ChannelType Index uint64 }
func NewLabel ¶
func NewLabel(ct ChannelType, idx uint64) *Label
type Peer ¶
type Peer struct { *ChannelPool // contains filtered or unexported fields }
func NewAnswerPeer ¶
func NewAnswerPeer(sig Signalinger, remoteClientId, remoteId string, accept chan ReadWriterReleaser) (*Peer, error)
func NewOfferPeer ¶
func NewOfferPeer(sig Signalinger, remoteClientId string) (*Peer, error)
func (*Peer) OnConnectionStateChange ¶
func (p *Peer) OnConnectionStateChange(pcs webrtc.PeerConnectionState)
type ReadWriterReleaser ¶
type ServerAddr ¶
func NewServerAddr ¶
func NewServerAddr(serverName string, label *Label) *ServerAddr
func (*ServerAddr) Network ¶
func (a *ServerAddr) Network() string
func (*ServerAddr) String ¶
func (a *ServerAddr) String() string
type Session ¶
func NewSession ¶
func (*Session) OnIceCandidate ¶
func (s *Session) OnIceCandidate(ice *webrtc.ICECandidate)
type Signalinger ¶
type Signalinger interface { Id() string NewPeer() chan ClientPeer SendPacket(ctx context.Context, p proto.Packet) error RemoteSdp(id string) chan webrtc.SessionDescription RemoteIceCandidates(id string) chan *webrtc.ICECandidate Run(ctx context.Context) error Close(ctx context.Context) error CloseSession(id string) IsClose() bool }
type WsBackendSigClient ¶
type WsBackendSigClient struct { *WsSigClient // contains filtered or unexported fields }
func NewWsBackendSigClient ¶
func NewWsBackendSigClient(id, wsURL, clusterName string) *WsBackendSigClient
func (*WsBackendSigClient) NewClient ¶
func (c *WsBackendSigClient) NewClient() chan ClientPeer
func (*WsBackendSigClient) OnSession ¶
func (c *WsBackendSigClient) OnSession(id, clientId string)
type WsFrontendSigClient ¶
type WsFrontendSigClient struct {
*WsSigClient
}
func NewWsFrontendSigClient ¶
func NewWsFrontendSigClient(id, wsURL, clusterName string) *WsFrontendSigClient
func (*WsFrontendSigClient) NewClient ¶
func (c *WsFrontendSigClient) NewClient() chan string
type WsSigClient ¶
type WsSigClient struct { sync.RWMutex websocket.Upgrader Type webrtc.SDPType OnSession func(id, cid string) // contains filtered or unexported fields }
func NewWsSigClient ¶
func NewWsSigClient(id, wsURL, clusterName string) *WsSigClient
func (*WsSigClient) CloseSession ¶
func (c *WsSigClient) CloseSession(id string)
func (*WsSigClient) GetSession ¶
func (c *WsSigClient) GetSession(id string) *Session
func (*WsSigClient) Id ¶
func (c *WsSigClient) Id() string
func (*WsSigClient) IsClose ¶
func (c *WsSigClient) IsClose() bool
func (*WsSigClient) RemoteIceCandidates ¶
func (c *WsSigClient) RemoteIceCandidates(id string) chan *webrtc.ICECandidate
func (*WsSigClient) RemoteSdp ¶
func (c *WsSigClient) RemoteSdp(id string) chan webrtc.SessionDescription
func (*WsSigClient) SendPacket ¶
Click to show internal directories.
Click to hide internal directories.