Documentation ¶
Overview ¶
Package goturn is a native go language interface to STUN and TURN.
Index ¶
- Constants
- func NewAllocateRequest(network string, authenticated bool) (*common.Message, error)
- func NewBindingRequest() (*common.Message, error)
- func NewConnectRequest(to net.Addr) (*common.Message, error)
- func NewConnectionBindRequest(connectionID uint32) (*common.Message, error)
- func NewPermissionRequest(to net.Addr) (*common.Message, error)
- func NewSendIndication(host net.IP, port uint16, data []byte) (*common.Message, error)
- func ParseStun(data []byte) (*common.Message, error)
- func ParseTurn(data []byte, credentials *common.Credentials) (*common.Message, error)
Constants ¶
const ( BindingRequest common.HeaderType = 0x0001 BindingResponse = 0x0101 BindingError = 0x0111 )
STUN (RFC 5389) defined message types.
const ( AllocateRequest common.HeaderType = 0x0003 RefreshRequest = 0x0004 CreatePermissionRequest = 0x0008 ChannelBindRequest = 0x0009 ConnectRequest = 0x000a ConnectionBindRequest = 0x000b SendIndication = 0x0016 DataIndication = 0x0017 ConnectionAttemptIndication = 0x001c AllocateResponse = 0x0103 RefreshResponse = 0x0104 CreatePermissionResponse = 0x0108 ChannelBindResponse = 0x0109 ConnectResponse = 0x010a ConnectionBindResponse = 0x010b AllocateError = 0x0113 RefreshError = 0x0114 CreatePermissionError = 0x0118 ChannelBindError = 0x0119 ConnectError = 0x011a ConnectionBindError = 0x011b )
TURN (RFC 5766) defined message types.
const ( EvenPort common.AttributeType = 0x18 DontFragment = 0x1A ReservationToken = 0x22 )
Deprecated: Should live in individual turn attribute implementations.
const (
AlternateServer common.AttributeType = 0x8023
)
Deprecated: Should live in individual stun attribute implementations.
Variables ¶
This section is empty.
Functions ¶
func NewAllocateRequest ¶
NewAllocateRequest creates a new message requesting authorization with a remote server. The allocation request specifies the type of remote network that the client wishes interact with.
func NewBindingRequest ¶
NewBindingRequest creates a STUN message for a client binding request.
func NewConnectRequest ¶
NewConnectRequest creates a message representing a request to create a new TCP connection for exchanging data with a remote address, Per RFC 6062.
func NewConnectionBindRequest ¶
NewConnectionBindRequest creates a message representing a request to turn the current connection with the server into a TCP connection relayed to a remote peer specified by a previously generated ConnectionID. Per RFC 6062.
func NewPermissionRequest ¶
NewPermissionRequest creates a message requesting permission from the server to allow sending and receiving data with a remote Address.
func NewSendIndication ¶
NewSendIndication creates a message representing a request to send a message of data over an existing allocation.
func ParseStun ¶
ParseStun parses a message in RFC 5389 STUN format. Attributes defined in subsequent standards will not be parsed.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package client provides a high-level interface for connecting and querying STUN and TURN services.
|
Package client provides a high-level interface for connecting and querying STUN and TURN services. |
Package stun represents the common data structures used in creating and parsing STUN messages.
|
Package stun represents the common data structures used in creating and parsing STUN messages. |
examples
|
|
getIP
Package main Example requesting STUN binding from a remote server.
|
Package main Example requesting STUN binding from a remote server. |
reflexiveTurn
Package main Example relays a message through a TURN server using the low-level interface.
|
Package main Example relays a message through a TURN server using the low-level interface. |
tcpTurn
Package main Example uses net.Http over a TURN connection.
|
Package main Example uses net.Http over a TURN connection. |
Package stun represents the attributes defined in the STUN RFC Standard.
|
Package stun represents the attributes defined in the STUN RFC Standard. |
Package turn represents the attributes defined in the TURN RFC Standard.
|
Package turn represents the attributes defined in the TURN RFC Standard. |