Noble Connect
Add relays and punchthrough to Mirror or UNet
NobleConnect.Ice.Controller Class Reference

Inherits IDisposable.

Public Member Functions

 Controller (IceConfig config)
 
void Update ()
 
void OnFailedToSelectCandidate (Transaction< Stun.Message > transaction)
 
void StartAsHost (Action< string, ushort > onReadyForMatchmaking=null, Action< CandidatePair > onCandidatePairSelected=null, Action< CandidatePair, CandidatePair > onConnectionReEstablished=null)
 
void StartAsClient (IPEndPoint relayEndPoint, Action< CandidatePair > onCandidatePairSelected, Action< CandidatePair, CandidatePair > onConnectionReEstablished)
 
void FinalizeSession (Session session)
 
void GatherLocalCandidates ()
 
void GatherHostCandidates ()
 
void GatherReflexiveAndRelayCandidates ()
 
void OnUnRecoverableAllocationLoss (bool wasInitialConnection=false)
 
void OnAllocationFailed (Candidate candidate, Stun.Message message, List< Candidate > failedAllocationCandidates, ManualResetEvent finishedEvent)
 
Candidate OnAllocateSuccess (Candidate hostCandidate, Stun.Message response, ManualResetEvent finishedEvent=null)
 
void Dispose ()
 

Static Public Member Functions

static bool IsGlobalIPv6 (IPAddress address)
 

Public Attributes

IceConfig iceConfig = new IceConfig()
 
Guid PeerGUID = Guid.NewGuid()
 
List< CandidatelocalHostCandidates = new List<Candidate>()
 
object localCandidatesLock = new object()
 
List< CandidatelocalCandidates = new List<Candidate>()
 
Stun.Controller sdpStunController
 
Candidate sipRelayCandidate
 
object candidateStunControllersLock = new object()
 
readonly List< Stun.ControllercandidateStunControllers = new List<Stun.Controller>()
 
SessionList sessions = new SessionList()
 
IPEndPoint relayServerEndPointV4
 
IPEndPoint relayServerEndPointV6
 
Action< CandidatePaironCandidatePairSelected
 
ActionQueue actionQueue = new ActionQueue()
 
int controllerID
 
IPEndPoint sendOfferToThisAddressAfterGatheringLocalCandidates = null
 
Action< CandidatePair, CandidatePaironConnectionReEstablished = null
 A method to call when an allocation is lost and replaced. More...
 

Static Public Attributes

static RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider()
 

Properties

IPEndPoint relayEndPoint [get]
 The primary address of the primary relay More...
 

Constructor & Destructor Documentation

◆ Controller()

NobleConnect.Ice.Controller.Controller ( IceConfig  config)

Member Function Documentation

◆ Dispose()

void NobleConnect.Ice.Controller.Dispose ( )

◆ FinalizeSession()

void NobleConnect.Ice.Controller.FinalizeSession ( Session  session)

◆ GatherHostCandidates()

void NobleConnect.Ice.Controller.GatherHostCandidates ( )

◆ GatherLocalCandidates()

void NobleConnect.Ice.Controller.GatherLocalCandidates ( )

◆ GatherReflexiveAndRelayCandidates()

void NobleConnect.Ice.Controller.GatherReflexiveAndRelayCandidates ( )

◆ IsGlobalIPv6()

static bool NobleConnect.Ice.Controller.IsGlobalIPv6 ( IPAddress  address)
static

◆ OnAllocateSuccess()

Candidate NobleConnect.Ice.Controller.OnAllocateSuccess ( Candidate  hostCandidate,
Stun.Message  response,
ManualResetEvent  finishedEvent = null 
)

◆ OnAllocationFailed()

void NobleConnect.Ice.Controller.OnAllocationFailed ( Candidate  candidate,
Stun.Message  message,
List< Candidate failedAllocationCandidates,
ManualResetEvent  finishedEvent 
)

◆ OnFailedToSelectCandidate()

void NobleConnect.Ice.Controller.OnFailedToSelectCandidate ( Transaction< Stun.Message transaction)

◆ OnUnRecoverableAllocationLoss()

void NobleConnect.Ice.Controller.OnUnRecoverableAllocationLoss ( bool  wasInitialConnection = false)

◆ StartAsClient()

void NobleConnect.Ice.Controller.StartAsClient ( IPEndPoint  relayEndPoint,
Action< CandidatePair onCandidatePairSelected,
Action< CandidatePair, CandidatePair onConnectionReEstablished 
)

◆ StartAsHost()

void NobleConnect.Ice.Controller.StartAsHost ( Action< string, ushort >  onReadyForMatchmaking = null,
Action< CandidatePair onCandidatePairSelected = null,
Action< CandidatePair, CandidatePair onConnectionReEstablished = null 
)

◆ Update()

void NobleConnect.Ice.Controller.Update ( )

Member Data Documentation

◆ actionQueue

ActionQueue NobleConnect.Ice.Controller.actionQueue = new ActionQueue()

◆ candidateStunControllers

readonly List<Stun.Controller> NobleConnect.Ice.Controller.candidateStunControllers = new List<Stun.Controller>()

◆ candidateStunControllersLock

object NobleConnect.Ice.Controller.candidateStunControllersLock = new object()

◆ controllerID

int NobleConnect.Ice.Controller.controllerID

◆ iceConfig

IceConfig NobleConnect.Ice.Controller.iceConfig = new IceConfig()

◆ localCandidates

List<Candidate> NobleConnect.Ice.Controller.localCandidates = new List<Candidate>()

◆ localCandidatesLock

object NobleConnect.Ice.Controller.localCandidatesLock = new object()

◆ localHostCandidates

List<Candidate> NobleConnect.Ice.Controller.localHostCandidates = new List<Candidate>()

◆ onCandidatePairSelected

Action<CandidatePair> NobleConnect.Ice.Controller.onCandidatePairSelected

◆ onConnectionReEstablished

Action<CandidatePair, CandidatePair> NobleConnect.Ice.Controller.onConnectionReEstablished = null

A method to call when an allocation is lost and replaced.

This is used by Peers to correct the application bridges when an allocation changes.

◆ PeerGUID

Guid NobleConnect.Ice.Controller.PeerGUID = Guid.NewGuid()

◆ relayServerEndPointV4

IPEndPoint NobleConnect.Ice.Controller.relayServerEndPointV4

◆ relayServerEndPointV6

IPEndPoint NobleConnect.Ice.Controller.relayServerEndPointV6

◆ RNG

RNGCryptoServiceProvider NobleConnect.Ice.Controller.RNG = new RNGCryptoServiceProvider()
static

◆ sdpStunController

Stun.Controller NobleConnect.Ice.Controller.sdpStunController

◆ sendOfferToThisAddressAfterGatheringLocalCandidates

IPEndPoint NobleConnect.Ice.Controller.sendOfferToThisAddressAfterGatheringLocalCandidates = null

◆ sessions

SessionList NobleConnect.Ice.Controller.sessions = new SessionList()

◆ sipRelayCandidate

Candidate NobleConnect.Ice.Controller.sipRelayCandidate

Property Documentation

◆ relayEndPoint

IPEndPoint NobleConnect.Ice.Controller.relayEndPoint
get

The primary address of the primary relay

This is the address a peer is most likely to be able to receive on. The initial sip invite and response are sent over this end point. Ultimately this end point may or may not be used for the actual connection. If a better (non-relay) connection is found it will be used instead.