stun

package
v4.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package stun contains ICE specific STUN code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertUsername

func AssertUsername(m *stun.Message, expectedUsername string) error

AssertUsername checks that the given STUN message m has a USERNAME attribute with a given value.

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

Cached returns a successful result while it remains within ttl.

func (*XORMappedAddrTransaction) Get added in v4.4.2

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

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.

Jump to

Keyboard shortcuts

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