Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement full ICE #56

Merged
merged 19 commits into from
Aug 11, 2018
Merged

Implement full ICE #56

merged 19 commits into from
Aug 11, 2018

Conversation

Sean-Der
Copy link
Member

@Sean-Der Sean-Der commented Aug 1, 2018

The is the overall architecture.

ICEAgent is a member of network/manager. (All of the state in network/manager could go directly on RTCPeerConnection. I think we should keep the code in the top-level as terse as possible. If it isn't relevant for a user to browse/read it should be in internal or pkg.)

Each port push/pulls from ICEAgent the STUN traffic for send/recv. The ICEAgent itself has all the timers/selected-pair.

When data comes from the RTCPeerConnection it queries the ICEAgent for the selected pair, and if it has one it will admin the proper src/dest. Otherwise it will return nothing and the traffic will be dropped/queued.


All tests and lints pass, and the examples still work! After this lands IMO this is what we need to knock out.

  • Integration tests (can Pion talk to itself?) that is gonna go a long way (send a packet, and the test passes when we recv)
  • FireFox support
  • Pion can open datachannels itself.
  • Update CONTRIBUTOR doc/steer people toward what issues we care about most. We need to create more Go generic tasks, not deep stuff
  • Public website

@Sean-Der Sean-Der requested review from kc5nra and backkem August 1, 2018 17:34
@coveralls
Copy link

coveralls commented Aug 1, 2018

Pull Request Test Coverage Report for Build 397

  • 145 of 626 (23.16%) changed or added relevant lines in 15 files are covered.
  • 66 unchanged lines in 12 files lost coverage.
  • Overall coverage increased (+1.5%) to 26.841%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rtcpeerconnection.go 10 11 90.91%
internal/srtp/srtp.go 0 2 0.0%
internal/sdp/jsep.go 0 2 0.0%
rtcconfiguration.go 1 8 12.5%
media.go 0 7 0.0%
internal/network/util.go 19 28 67.86%
internal/network/port-send.go 0 11 0.0%
pkg/ice/candidate.go 0 18 0.0%
internal/dtls/dtls.go 3 24 12.5%
internal/network/port-receive.go 2 26 7.69%
Files with Coverage Reduction New Missed Lines %
rtcconfiguration.go 1 33.33%
internal/network/port-send.go 1 0.0%
media.go 1 0.0%
internal/network/port-receive.go 1 9.09%
rtcpeerconnection.go 2 19.64%
internal/srtp/srtp.go 2 60.0%
internal/network/manager.go 2 16.67%
internal/sdp/unmarshal.go 2 60.39%
signaling.go 3 13.53%
internal/sdp/util.go 3 0.0%
Totals Coverage Status
Change from base Build 361: 1.5%
Covered Lines: 1126
Relevant Lines: 4195

💛 - Coveralls


// String for CandidateHost
func (c *CandidateHost) String(component int) string {
return fmt.Sprintf("udpcandidate %d udp %d %s %d typ host generation 0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feelings about this approach. It seems rather clean but this way we are leaking SDP details into the ICE package. E.g.: If we ever want to support the ORTC API this string format doesn't apply anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree!

Are you ok with the SDP package importing ICE? I can have it case off the Candidate type in there.

Then it can generate the string exactly the same way (and then in the future we can add ORTC support)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does seem more appropriate. ICE does seem like a pretty big dependency for the SDP package but we can worry about that another time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@Sean-Der Sean-Der changed the title Implement full ICE [WIP] Implement full ICE Aug 7, 2018
@Sean-Der Sean-Der force-pushed the full-ice branch 3 times, most recently from faf22b3 to 52ffc29 Compare August 11, 2018 06:37
@Sean-Der Sean-Der changed the title [WIP] Implement full ICE Implement full ICE Aug 11, 2018
Candidates are now generated with real priority, and actually pay
attention to the inbound messages.

Next we just need to pluck use-candidate + ice-controlling from the
messages and we will have a full-ice implementation (but we are not
controlling)

We then need to add timers to alert when the peer goes away OR when we
need to send again.
All the examples need to be updated, SDP should only be
emitted after gathering is done (until we support trickle)

Currently we can't be controlling-ICE, but that is probably a days
worth of work. After that is done pion-WebRTC should be able to talk
to itself.
All our examples will need to be updated, now that pion-WebRTC
properly implements full ICE it will discard messages from candidates
that don't appear in the remote offer/answer
pion-WebRTC passes through every step, but messages get discared because
MI check is failing. We are able to Offer (or answer) to Chrome after
this is done
Examples need to be expanded to demo this, and lints need to be
fixed but no additional code/features are needed
}

// Start allocates DTLS/ICE state that is dependent on if we are offering or answering
func (m *Manager) Start(isOffer bool, remoteUfrag, remotePwd string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using IsOffer as the DTLS and ICE role a deliberate shortcut for now? My current understanding of the specs:

  • ICE: The role is based on who is offering but we should take into account if the other ICE client is a lite agent.
  • DTLS: The role is negotiated using the setup attribute. (It feels like this may be a requirement for pions to pions connections?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! I am going to cut a ticket for support ice-lite and going to be testing against mediasoup. So will changed to isControllingICE and dtlsRole maybe?

DTLS does work right now using just offer/answer. The setup attribute just allows someone to fast start (which we should do in the future) but wasn't going to do yet.

@Sean-Der Sean-Der merged commit aee7900 into master Aug 11, 2018
@Sean-Der Sean-Der mentioned this pull request Aug 11, 2018
@Sean-Der Sean-Der deleted the full-ice branch August 12, 2018 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants