Documentation
¶
Overview ¶
Package stun contains ICE specific STUN code
Index ¶
- func AssertUsername(m *stun.Message, expectedUsername string) error
- type XORMappedAddrTransaction
- func (t *XORMappedAddrTransaction) Cached(ttl time.Duration) (*stun.XORMappedAddress, bool)
- func (t *XORMappedAddrTransaction) Get(ctx context.Context, timeout time.Duration, ...) (*stun.XORMappedAddress, error)
- func (t *XORMappedAddrTransaction) HandleResponse(msg *stun.Message) bool
- func (t *XORMappedAddrTransaction) ID() [stun.TransactionIDSize]byte
- func (t *XORMappedAddrTransaction) RunPacketConn(ctx context.Context, conn net.PacketConn, serverAddr net.Addr, ...) (*stun.XORMappedAddress, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type XORMappedAddrTransaction ¶ added in v4.4.2
type XORMappedAddrTransaction struct {
// contains filtered or unexported fields
}
XORMappedAddrTransaction is a stateful STUN binding transaction. Responses may be delivered asynchronously with HandleResponse.
func NewXORMappedAddrTransaction ¶ added in v4.4.2
func NewXORMappedAddrTransaction() (*XORMappedAddrTransaction, error)
NewXORMappedAddrTransaction creates a STUN binding transaction.
func (*XORMappedAddrTransaction) Cached ¶ added in v4.4.2
func (t *XORMappedAddrTransaction) Cached(ttl time.Duration) (*stun.XORMappedAddress, bool)
Cached returns a successful result while it remains within ttl.
func (*XORMappedAddrTransaction) Get ¶ added in v4.4.2
func (t *XORMappedAddrTransaction) Get( ctx context.Context, timeout time.Duration, send func(context.Context, []byte) error, ) (*stun.XORMappedAddress, error)
Get runs the transaction and waits for its result. A non-positive timeout expires before sending.
func (*XORMappedAddrTransaction) HandleResponse ¶ added in v4.4.2
func (t *XORMappedAddrTransaction) HandleResponse(msg *stun.Message) bool
HandleResponse validates and completes the transaction with a decoded STUN response. It reports whether the message belongs to this transaction.
func (*XORMappedAddrTransaction) ID ¶ added in v4.4.2
func (t *XORMappedAddrTransaction) ID() [stun.TransactionIDSize]byte
ID returns the transaction ID used to route STUN responses.
func (*XORMappedAddrTransaction) RunPacketConn ¶ added in v4.4.2
func (t *XORMappedAddrTransaction) RunPacketConn( ctx context.Context, conn net.PacketConn, serverAddr net.Addr, timeout time.Duration, ) (*stun.XORMappedAddress, error)
RunPacketConn runs the transaction on a dedicated packet connection. The transaction reads responses from conn while Get owns retransmission timing.