Documentation ¶
Index ¶
- Variables
- func Conn2Mux(conn *net.UDPConn) ice.UDPMux
- func GetHKDFParamPair(seed string) (server, client *seed2sdp.HKDFParams)
- func Mux2WebRTC(ctx context.Context, mux ice.UDPMux, seeds []string, ...) (wrappedConn *transportc.WebRTConn, matchedID int, err error)
- func RandPort(seed string) uint16
- func SetBasePort(port uint16)
- func SetClientIdentifier(identifier string)
- func SetPortRange(range_ int64)
- func SetRandSalt(salt string)
- func SetServerIdentifier(identifier string)
- type Client
- func (c *Client) Connect(ctx context.Context, phantoms []*net.IP) (net.Conn, error)
- func (c *Client) LocalSDP() (*seed2sdp.SDP, error)
- func (c *Client) OriginalLocalSDP() (string, error)
- func (c *Client) Prepare() error
- func (c *Client) Seed() string
- func (c *Client) WebRTCSignal() (*tdproto.WebRTCSignal, error)
- type ClientSetup
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrArrLengthMismatch = errors.New("length of sdp slice and seeds do not match") ErrNoRegistration = errors.New("no registration found") )
Functions ¶
func GetHKDFParamPair ¶
func GetHKDFParamPair(seed string) (server, client *seed2sdp.HKDFParams)
func Mux2WebRTC ¶
func Mux2WebRTC(ctx context.Context, mux ice.UDPMux, seeds []string, clientSDPs []*seed2sdp.SDP, clientSetup ClientSetup) (wrappedConn *transportc.WebRTConn, matchedID int, err error)
Mux2WebRTC creates a new WebRTC (as an answerer) DataChannel connection from a given mux For input, clientSDPs must all be of type Offer, seeds/clientSDPs must not be shared between multiple concurrent calls Mux2WebRTC will return a ready-to-go WebRTConn and the idx of which SDP is used.
func SetBasePort ¶
func SetBasePort(port uint16)
func SetClientIdentifier ¶
func SetClientIdentifier(identifier string)
func SetPortRange ¶
func SetPortRange(range_ int64)
func SetRandSalt ¶
func SetRandSalt(salt string)
func SetServerIdentifier ¶
func SetServerIdentifier(identifier string)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func DefaultClient ¶
DefaultClient() generates a crypto/rand seed for a new client
func (*Client) Connect ¶
When building the UDP mux, add all phantoms' ICE candidate into one single SDP
func (*Client) LocalSDP ¶
LocalSDP omits fingerprint, ice-ufrag, ice-pwd and other predictable fields
func (*Client) OriginalLocalSDP ¶
func (*Client) Prepare ¶
Prepare() initializes the WebRTConn and generates the local SDP offer This function should be called before c.LocalSDP() or c.DeflatedLocalSDP()
func (*Client) WebRTCSignal ¶
func (c *Client) WebRTCSignal() (*tdproto.WebRTCSignal, error)
type ClientSetup ¶
type ClientSetup string
const ( CLIENT_SETUP_ACTPASS ClientSetup = "actpass" CLIENT_SETUP_ACTIVE ClientSetup = "active" CLIENT_SETUP_PASSIVE ClientSetup = "passive" )
Click to show internal directories.
Click to hide internal directories.