turnconn

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Proxy is a an ICE Server that uses a special hostname
	// to indicate traffic should be proxied.
	Proxy = webrtc.ICEServer{
		URLs:       []string{"turns:" + reservedAddress},
		Username:   "coder",
		Credential: credential,
	}
)

Functions

func ProxyDialer

func ProxyDialer(proxyFunc func() (c net.Conn, err error)) proxy.Dialer

ProxyDialer accepts a proxy function that's called when the connection address matches the reserved host in the "Proxy" ICE server.

This should be passed to WebRTC connections as an ICE dialer.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Closed

func (c *Conn) Closed() <-chan struct{}

Closed returns a channel which is closed when the connection is.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server accepts and connects TURN allocations.

This is a thin wrapper around pion/turn that pipes connections directly to the in-memory handler.

func New

func New(relayAddress *turn.RelayAddressGeneratorStatic) (*Server, error)

New constructs a new TURN server binding to the relay address provided. The relay address is used to broadcast the location of an accepted connection.

func (*Server) Accept

func (s *Server) Accept(nc net.Conn, remoteAddress, localAddress *net.TCPAddr) *Conn

Accept consumes a new connection into the TURN server. A unique remote address must exist per-connection. pion/turn indexes allocations based on the address.

func (*Server) Close

func (s *Server) Close() error

Close ends the TURN server.

Jump to

Keyboard shortcuts

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