Documentation ¶
Index ¶
- Variables
- type Allocation
- type Client
- type Options
- type Permission
- func (p *Permission) Bind() error
- func (p *Permission) Binding() turn.ChannelNumber
- func (p *Permission) Bound() bool
- func (p *Permission) Close() error
- func (p *Permission) LocalAddr() net.Addr
- func (p *Permission) Read(b []byte) (n int, err error)
- func (p *Permission) RemoteAddr() net.Addr
- func (p *Permission) SetDeadline(t time.Time) error
- func (p *Permission) SetReadDeadline(t time.Time) error
- func (p *Permission) SetWriteDeadline(t time.Time) error
- func (p *Permission) Write(b []byte) (n int, err error)
- type STUNClient
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAlreadyBound means that selected permission already has bound channel number. ErrAlreadyBound = errors.New("channel already bound") // ErrNotBound means that selected permission already has no channel number. ErrNotBound = errors.New("channel is not bound") )
var ErrNotImplemented = errors.New("functionality not implemented")
ErrNotImplemented means that functionality is not currently implemented, but it will be (eventually).
Functions ¶
This section is empty.
Types ¶
type Allocation ¶
type Allocation struct {
// contains filtered or unexported fields
}
Allocation reflects TURN Allocation.
func (*Allocation) Create ¶
func (a *Allocation) Create(peer net.Addr) (*Permission, error)
Create creates new permission to peer.
func (*Allocation) CreateUDP ¶
func (a *Allocation) CreateUDP(addr *net.UDPAddr) (*Permission, error)
CreateUDP creates new UDP Permission to peer with provided addr.
func (*Allocation) Relayed ¶ added in v0.0.3
func (a *Allocation) Relayed() turn.RelayedAddress
Relayed returns the relayed address for the allocation
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for TURN server.
Provides transparent net.Conn interfaces to remote peers.
func (*Client) Allocate ¶
func (c *Client) Allocate() (*Allocation, error)
Allocate creates an allocation for current 5-tuple. Currently there can be only one allocation per client, because client wraps one net.Conn.
func (*Client) RefreshRate ¶
RefreshRate returns current rate of refresh requests.
type Options ¶ added in v0.0.2
type Options struct { Conn net.Conn STUN STUNClient // optional STUN client Log logging.LeveledLogger // defaults to Nop // Long-term integrity. Username string Password string // STUN client options. RTO time.Duration NoRetransmit bool // TURN options. RefreshRate time.Duration RefreshDisabled bool // ConnManualClose disables connection automatic close on Close(). ConnManualClose bool }
Options contains available config for TURN client.
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
Permission implements net.PacketConn.
func (*Permission) Bind ¶
func (p *Permission) Bind() error
Bind performs binding transaction, allocating channel binding for the permission.
func (*Permission) Binding ¶
func (p *Permission) Binding() turn.ChannelNumber
Binding returns current channel number or 0 if not bound.
func (*Permission) Bound ¶
func (p *Permission) Bound() bool
Bound returns true if channel number is bound for current permission.
func (*Permission) Close ¶
func (p *Permission) Close() error
Close stops all refreshing loops for permission and removes it from allocation.
func (*Permission) LocalAddr ¶
func (p *Permission) LocalAddr() net.Addr
LocalAddr is relayed address from TURN server.
func (*Permission) Read ¶
func (p *Permission) Read(b []byte) (n int, err error)
Read data from peer.
func (*Permission) RemoteAddr ¶
func (p *Permission) RemoteAddr() net.Addr
RemoteAddr is peer address.
func (*Permission) SetDeadline ¶
func (p *Permission) SetDeadline(t time.Time) error
SetDeadline implements net.Conn.
func (*Permission) SetReadDeadline ¶
func (p *Permission) SetReadDeadline(t time.Time) error
SetReadDeadline implements net.Conn.
func (*Permission) SetWriteDeadline ¶
func (p *Permission) SetWriteDeadline(t time.Time) error
SetWriteDeadline implements net.Conn.