package proto

Import Path
	github.com/pion/turn/v4/internal/proto (on go.dev)

Dependency Relation
	imports 9 packages, and imported by 4 packages

Involved Source Files addr.go chandata.go chann.go connection_id.go data.go dontfrag.go evenport.go lifetime.go peeraddr.go Package proto implements RFC 5766 Traversal Using Relays around NAT. relayedaddr.go reqfamily.go reqtrans.go rsrvtoken.go
Package-Level Type Names (total 18)
/* sort by: | */
Addr is ip:port. IP net.IP Port int Equal returns true if b == a. EqualIP returns true if a and b have equal IP addresses. FromUDPAddr sets addr to UDPAddr. Network implements net.Addr. ( Addr) String() string Addr : expvar.Var Addr : fmt.Stringer Addr : net.Addr func Addr.Equal(b Addr) bool func Addr.EqualIP(b Addr) bool
ChannelData represents The ChannelData Message. See RFC 5766 Section 11.4. // Can be sub slice of Raw // Ignored while encoding, len(Data) is used Number ChannelNumber Raw []byte Decode decodes The ChannelData Message from Raw. Encode encodes ChannelData Message to Raw. Equal returns true if compareTo == c. Reset resets Length, Data and Raw length. WriteHeader writes channel number and length. func (*ChannelData).Equal(compareTo *ChannelData) bool
ChannelNumber represents CHANNEL-NUMBER attribute. The CHANNEL-NUMBER attribute contains the number of the channel. RFC 5766 Section 14.1. AddTo adds CHANNEL-NUMBER to message. GetFrom decodes CHANNEL-NUMBER from message. ( ChannelNumber) String() string Valid returns true if channel number has correct value that complies RFC 5766 Section 11 range. *ChannelNumber : github.com/pion/stun/v3.Getter ChannelNumber : github.com/pion/stun/v3.Setter ChannelNumber : expvar.Var ChannelNumber : fmt.Stringer func github.com/pion/turn/v4/internal/allocation.NewChannelBind(number ChannelNumber, peer net.Addr, log logging.LeveledLogger) *allocation.ChannelBind func github.com/pion/turn/v4/internal/allocation.(*Allocation).GetChannelByNumber(number ChannelNumber) *allocation.ChannelBind func github.com/pion/turn/v4/internal/allocation.(*Allocation).RemoveChannelBind(number ChannelNumber) bool
ConnectionID represents CONNECTION-ID attribute. The CONNECTION-ID attribute uniquely identifies a peer data connection. It is a 32-bit unsigned integral value. RFC 6062 Section 6.2.1. AddTo adds CONNECTION-ID to message. GetFrom decodes CONNECTION-ID from message. *ConnectionID : github.com/pion/stun/v3.Getter ConnectionID : github.com/pion/stun/v3.Setter func github.com/pion/turn/v4/internal/client.(*TCPAllocation).Connect(peer net.Addr) (ConnectionID, error) func github.com/pion/turn/v4/internal/client.(*TCPAllocation).BindConnection(dataConn *client.TCPConn, cid ConnectionID) error func github.com/pion/turn/v4/internal/client.(*TCPAllocation).HandleConnectionAttempt(from *net.TCPAddr, cid ConnectionID)
Data represents DATA attribute. The DATA attribute is present in all Send and Data indications. The value portion of this attribute is variable length and consists of the application data (that is, the data that would immediately follow the UDP header if the data was been sent directly between the client and the peer). RFC 5766 Section 14.4. AddTo adds DATA to message. GetFrom decodes DATA from message. *Data : github.com/pion/stun/v3.Getter Data : github.com/pion/stun/v3.Setter
DontFragment represents DONT-FRAGMENT attribute. This attribute is used by the client to request that the server set the DF (Don't Fragment) bit in the IP header when relaying the application data onward to the peer. This attribute has no value part and thus the attribute length field is 0. RFC 5766 Section 14.8. AddTo adds DONT-FRAGMENT attribute to message. GetFrom decodes DONT-FRAGMENT from message. IsSet returns true if DONT-FRAGMENT attribute is set. *DontFragment : github.com/pion/stun/v3.Getter DontFragment : github.com/pion/stun/v3.Setter
DontFragmentAttr is a deprecated alias for DontFragment Deprecated: Please use DontFragment.
EvenPort represents EVEN-PORT attribute. This attribute allows the client to request that the port in the relayed transport address be even, and (optionally) that the server reserve the next-higher port number. RFC 5766 Section 14.6. ReservePort means that the server is requested to reserve the next-higher port number (on the same IP address) for a subsequent allocation. AddTo adds EVEN-PORT to message. GetFrom decodes EVEN-PORT from message. ( EvenPort) String() string *EvenPort : github.com/pion/stun/v3.Getter EvenPort : github.com/pion/stun/v3.Setter EvenPort : expvar.Var EvenPort : fmt.Stringer
FiveTuple represents 5-TUPLE value. Client Addr Proto Protocol Server Addr Equal returns true if b == t. ( FiveTuple) String() string FiveTuple : expvar.Var FiveTuple : fmt.Stringer func FiveTuple.Equal(b FiveTuple) bool
Lifetime represents LIFETIME attribute. The LIFETIME attribute represents the duration for which the server will maintain an allocation in the absence of a refresh. The value portion of this attribute is 4-bytes long and consists of a 32-bit unsigned integral value representing the number of seconds remaining until expiration. RFC 5766 Section 14.2. Duration time.Duration Abs returns the absolute value of d. As a special case, Duration([math.MinInt64]) is converted to Duration([math.MaxInt64]), reducing its magnitude by 1 nanosecond. AddTo adds LIFETIME to message. GetFrom decodes LIFETIME from message. Hours returns the duration as a floating point number of hours. Microseconds returns the duration as an integer microsecond count. Milliseconds returns the duration as an integer millisecond count. Minutes returns the duration as a floating point number of minutes. Nanoseconds returns the duration as an integer nanosecond count. Round returns the result of rounding d to the nearest multiple of m. The rounding behavior for halfway values is to round away from zero. If the result exceeds the maximum (or minimum) value that can be stored in a [Duration], Round returns the maximum (or minimum) duration. If m <= 0, Round returns d unchanged. Seconds returns the duration as a floating point number of seconds. String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s. Truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged. *Lifetime : github.com/pion/stun/v3.Getter Lifetime : github.com/pion/stun/v3.Setter Lifetime : expvar.Var Lifetime : fmt.Stringer
PeerAddress implements XOR-PEER-ADDRESS attribute. The XOR-PEER-ADDRESS specifies the address and port of the peer as seen from the TURN server. (For example, the peer's server-reflexive transport address if the peer is behind a NAT.) RFC 5766 Section 14.3. IP net.IP Port int AddTo adds XOR-PEER-ADDRESS to message. GetFrom decodes XOR-PEER-ADDRESS from message. ( PeerAddress) String() string *PeerAddress : github.com/pion/stun/v3.Getter PeerAddress : github.com/pion/stun/v3.Setter PeerAddress : expvar.Var PeerAddress : fmt.Stringer
Protocol is IANA assigned protocol number. ( Protocol) String() string Protocol : expvar.Var Protocol : fmt.Stringer const ProtoTCP const ProtoUDP
RelayedAddress implements XOR-RELAYED-ADDRESS attribute. It specifies the address and port that the server allocated to the client. It is encoded in the same way as XOR-MAPPED-ADDRESS. RFC 5766 Section 14.5. IP net.IP Port int AddTo adds XOR-PEER-ADDRESS to message. GetFrom decodes XOR-PEER-ADDRESS from message. ( RelayedAddress) String() string *RelayedAddress : github.com/pion/stun/v3.Getter RelayedAddress : github.com/pion/stun/v3.Setter RelayedAddress : expvar.Var RelayedAddress : fmt.Stringer
RequestedAddressFamily represents the REQUESTED-ADDRESS-FAMILY Attribute as defined in RFC 6156 Section 4.1.1. AddTo adds REQUESTED-ADDRESS-FAMILY to message. GetFrom decodes REQUESTED-ADDRESS-FAMILY from message. ( RequestedAddressFamily) String() string *RequestedAddressFamily : github.com/pion/stun/v3.Getter RequestedAddressFamily : github.com/pion/stun/v3.Setter RequestedAddressFamily : expvar.Var RequestedAddressFamily : fmt.Stringer const RequestedFamilyIPv4 const RequestedFamilyIPv6
RequestedTransport represents REQUESTED-TRANSPORT attribute. This attribute is used by the client to request a specific transport protocol for the allocated transport address. RFC 5766 only allows the use of code point 17 (User Datagram Protocol). RFC 5766 Section 14.7. Protocol Protocol AddTo adds REQUESTED-TRANSPORT to message. GetFrom decodes REQUESTED-TRANSPORT from message. ( RequestedTransport) String() string *RequestedTransport : github.com/pion/stun/v3.Getter RequestedTransport : github.com/pion/stun/v3.Setter RequestedTransport : expvar.Var RequestedTransport : fmt.Stringer
ReservationToken represents RESERVATION-TOKEN attribute. The RESERVATION-TOKEN attribute contains a token that uniquely identifies a relayed transport address being held in reserve by the server. The server includes this attribute in a success response to tell the client about the token, and the client includes this attribute in a subsequent Allocate request to request the server use that relayed transport address for the allocation. RFC 5766 Section 14.9. AddTo adds RESERVATION-TOKEN to message. GetFrom decodes RESERVATION-TOKEN from message. *ReservationToken : github.com/pion/stun/v3.Getter ReservationToken : github.com/pion/stun/v3.Setter
XORPeerAddress implements XOR-PEER-ADDRESS attribute. The XOR-PEER-ADDRESS specifies the address and port of the peer as seen from the TURN server. (For example, the peer's server-reflexive transport address if the peer is behind a NAT.) RFC 5766 Section 14.3.
XORRelayedAddress implements XOR-RELAYED-ADDRESS attribute. It specifies the address and port that the server allocated to the client. It is encoded in the same way as XOR-MAPPED-ADDRESS. RFC 5766 Section 14.5.
Package-Level Functions (total 5)
AllocateRequest is shorthand for allocation request message type.
CreatePermissionRequest is shorthand for create permission request type.
IsChannelData returns true if buf looks like the ChannelData Message.
RefreshRequest is shorthand for refresh request message type.
SendIndication is shorthand for send indication message type.
Package-Level Variables (total 2)
ErrBadChannelDataLength means that channel data length is not equal to actual data length.
ErrInvalidChannelNumber means that channel number is not valid as by RFC 5766 Section 11.
Package-Level Constants (total 9)
DefaultLifetime in RFC 5766 is 10 minutes. RFC 5766 Section 2.2.
DefaultPort for TURN is same as STUN.
DefaultTLSPort is for TURN over TLS and is same as STUN.
See https://tools.ietf.org/html/rfc5766#section-11: 0x4000 through 0x7FFF: These values are the allowed channel numbers (16,383 possible values).
See https://tools.ietf.org/html/rfc5766#section-11: 0x4000 through 0x7FFF: These values are the allowed channel numbers (16,383 possible values).
ProtoTCP is IANA assigned protocol number for TCP.
ProtoUDP is IANA assigned protocol number for UDP.
Values for RequestedAddressFamily as defined in RFC 6156 Section 4.1.1.
Values for RequestedAddressFamily as defined in RFC 6156 Section 4.1.1.