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

turn.Client to allow net.Conn #87

Closed
enobufs opened this issue Aug 20, 2019 · 0 comments
Closed

turn.Client to allow net.Conn #87

enobufs opened this issue Aug 20, 2019 · 0 comments

Comments

@enobufs
Copy link
Member

enobufs commented Aug 20, 2019

Summary

As preparation for tackling TCP support TURN protocol (#1), TURN client implementation needs to be able to take net.Conn in addition to net.PacketConn.

Motivation

See #1.

Proposal

Current TURN Client design assumes that an instance of Client is created per socket (net.PacketConn). See Pion: TURN Client Refactor.
ClientConfig takes a parameter, net.PacketConn only, which needs to be changed.

Proposed change is to introduce an interface, turn.Conn which wraps both net.PacketConn and net.Conn.

// Conn a network connection interface with TURN server.
type Conn interface {
	LocalAddr() net.Addr // used to determine transport type and IP version
}

Justification: to prevent a user from trying to pass both net.PacketConn and net.Conn. (Client can only handle one underlying socket).

Above code won't work due to "duplicate method". We need to manually define methods.

Inside NetClient(), use type-switch to determine which transport protocol the app wants to use.

Sean-Der added a commit that referenced this issue Jan 14, 2020
Also update .goreleaser binary names to be more
self documenting

Resolves #87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant