whipconn

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

A simple WHIP client and server that implement a stream connection abstraction on top of a WebRTC data channel published via WHIP. Client adopted from https://github.com/ggarber/whip-go/

A simple WHIP client and server that implement a stream connection abstraction on top of a WebRTC data channel published via WHIP. Adopted from https://github.com/pion/webrtc/tree/master/examples/whip-whep

Index

Constants

View Source
const (
	WhipEndpoint = "/whip"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ICEServers                []webrtc.ICEServer
	ICETransportPolicy        webrtc.ICETransportPolicy
	BearerToken, WHIPEndpoint string
}

type Dialer

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

func NewDialer

func NewDialer(config Config, logger logging.LoggerFactory) *Dialer

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, addr string) (net.Conn, error)

func (*Dialer) WithSettingEngine

func (d *Dialer) WithSettingEngine(e webrtc.SettingEngine) *Dialer

type DialerConn

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

func (*DialerConn) Close

func (c *DialerConn) Close() error

func (*DialerConn) GetPeerConnection

func (c *DialerConn) GetPeerConnection() *webrtc.PeerConnection

GetPeerConnection returns the PeerConnection underlying the data channnel. Useful for checking ICE candidate status.

func (*DialerConn) LocalAddr

func (c *DialerConn) LocalAddr() net.Addr

TODO: implement

func (*DialerConn) Read

func (c *DialerConn) Read(b []byte) (int, error)

func (*DialerConn) RemoteAddr

func (c *DialerConn) RemoteAddr() net.Addr

func (*DialerConn) SetDeadline

func (c *DialerConn) SetDeadline(t time.Time) error

func (*DialerConn) SetReadDeadline

func (c *DialerConn) SetReadDeadline(t time.Time) error

func (*DialerConn) SetWriteDeadline

func (c *DialerConn) SetWriteDeadline(t time.Time) error

func (*DialerConn) String

func (c *DialerConn) String() string

String returns a unique identifier for the connection based on the underlying signaling connection.

func (*DialerConn) Write

func (c *DialerConn) Write(b []byte) (int, error)

type Listener

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

func NewListener

func NewListener(addr string, config Config, logger logging.LoggerFactory) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (*Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) GetConns

func (l *Listener) GetConns() []*ListenerConn

type ListenerConn

type ListenerConn struct {
	ResourceUrl string

	PeerConn *webrtc.PeerConnection

	DataConn datachannel.ReadWriteCloser
	// contains filtered or unexported fields
}

func (*ListenerConn) Close

func (c *ListenerConn) Close() error

func (*ListenerConn) LocalAddr

func (c *ListenerConn) LocalAddr() net.Addr

TODO: implement

func (*ListenerConn) Read

func (c *ListenerConn) Read(b []byte) (int, error)

func (*ListenerConn) RemoteAddr

func (c *ListenerConn) RemoteAddr() net.Addr

func (*ListenerConn) SetDeadline

func (c *ListenerConn) SetDeadline(t time.Time) error

func (*ListenerConn) SetReadDeadline

func (c *ListenerConn) SetReadDeadline(t time.Time) error

func (*ListenerConn) SetWriteDeadline

func (c *ListenerConn) SetWriteDeadline(t time.Time) error

func (*ListenerConn) String

func (c *ListenerConn) String() string

String returns a unique identifier for the connection based on the underlying signaling connection.

func (*ListenerConn) Write

func (c *ListenerConn) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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