stun协议.md 781 B

stun 协议 01

协议介绍

  1. 作用NAT穿越
  2. 客户端服务器方式交互

    客户端请求服务器,服务器返回数据给客户端

  3. 参考文档

    1. RFC3489/STUN > simple Traversal of UDP THrough NAT
    2. RFC5389 (新)

stun 协议组成

STUN header

字节数: 20

1. header 定义表

位数 定义 取值 长度(byt) 备注
1-2 stun message type -- 2 type
3-4 stun message Length -- 2 length
5-8 magic cookie -- 4 包含在 事务id,请求与响应相同
9-20 transaction ID -- 12 事务id,请求与响应相同

message type 字段解析

前两位为00 2位用于分类 c0 和 c1 12位定义消息类型

body Attribute

字节数: 不限