conjurtc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 Conn2Mux

func Conn2Mux(conn *net.UDPConn) ice.UDPMux

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 RandPort

func RandPort(seed string) uint16

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

func DefaultClient() (*Client, error)

DefaultClient() generates a crypto/rand seed for a new client

func NewClient

func NewClient(seed string, iceServers []webrtc.ICEServer) *Client

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, phantoms []*net.IP) (net.Conn, error)

When building the UDP mux, add all phantoms' ICE candidate into one single SDP

func (*Client) LocalSDP

func (c *Client) LocalSDP() (*seed2sdp.SDP, error)

LocalSDP omits fingerprint, ice-ufrag, ice-pwd and other predictable fields

func (*Client) OriginalLocalSDP

func (c *Client) OriginalLocalSDP() (string, error)

func (*Client) Prepare

func (c *Client) Prepare() error

Prepare() initializes the WebRTConn and generates the local SDP offer This function should be called before c.LocalSDP() or c.DeflatedLocalSDP()

func (*Client) Seed

func (c *Client) Seed() string

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"
)

Jump to

Keyboard shortcuts

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