Привет
- User
Привет
- Assistant
Здравствуйте! Как я могу вам помочь?
- User
Ты можешь перевести текст с английского на русский?
- Assistant
Да, конечно! Пожалуйста, дайте мне текст, который вы хотите перевести.
- User
A STUN server MUST be prepared to receive Binding Requests on four address/port combinations - (A1, P1), (A2, P1), (A1, P2), and (A2, P2). (A1, P1) represent the primary address and port, and these are the ones obtained through the client discovery procedures below. Typically, P1 will be port 3478, the default STUN port. A2 and P2 are arbitrary. A2 and P2 are advertised by the server through the CHANGED-ADDRESS attribute, as described below.
It is RECOMMENDED that the server check the Binding Request for a MESSAGE-INTEGRITY attribute. If not present, and the server requires integrity checks on the request, it generates a Binding Error Response with an ERROR-CODE attribute with response code 401. If the MESSAGE-INTEGRITY attribute was present, the server computes the HMAC over the request as described in Section 11.2.8. The key to use depends on the shared secret mechanism. If the STUN Shared Secret Request was used, the key MUST be the one associated with the USERNAME attribute present in the request. If the USERNAME attribute was not present, the server MUST generate a Binding Error Response. The Binding Error Response MUST include an ERROR-CODE attribute with response code 432. If the USERNAME is present, but the server doesn't remember the shared secret for that USERNAME (because it timed out, for example), the server MUST generate a Binding Error Response. The Binding Error Response MUST include an ERROR-CODE attribute with response code 430. If the server does know the shared secret, but the computed HMAC differs from the one in the request, the server MUST generate a Binding Error Response with an ERROR-CODE attribute with response code 431. The Binding Error Response is sent to the IP address and port the Binding Request came from, and sent from the IP address and port the Binding Request was sent to.
- Assistant
Вот перевод текста с английского на русский:
STUN-сервер ДОЛЖЕН быть готов принимать Binding Requests (запросы на привязку) на четырех комбинациях адресов и портов: (A1, P1), (A2, P1), (A1, P2) и (A2, P2). (A1, P1) представляют первичный адрес и порт, и это те, которые получаются через процедуры обнаружения клиента, описанные ниже. Обычно, P1 будет портом 3478, стандартным портом STUN. A2 и P2 являются произвольными. A2 и P2 сообщаются сервером через атрибут CHANGED-ADDRESS, как описано ниже.
- User
That response MUST contain an UNKNOWN-ATTRIBUTES attribute listing the attributes with values less than or equal to 0x7fff which were not understood. The Binding Error Response is sent to the IP address and port the Binding Request came from, and sent from the IP address and port the Binding Request was sent to.
Assuming the request was correctly formed, the server MUST generate a single Binding Response. The Binding Response MUST contain the same transaction ID contained in the Binding Request. The length in the message header MUST contain the total length of the message in bytes, excluding the header. The Binding Response MUST have a message type of "Binding Response".
The server MUST add a MAPPED-ADDRESS attribute to the Binding Response. The IP address component of this attribute MUST be set to the source IP address observed in the Binding Request. The port component of this attribute MUST be set to the source port observed in the Binding Request.
If the RESPONSE-ADDRESS attribute was absent from the Binding Request, the destination address and port of the Binding Response MUST be the same as the source address and port of the Binding Request. Otherwise, the destination address and port of the Binding Response MUST be the value of the IP address and port in the RESPONSE-ADDRESS attribute.
- Assistant
Вот перевод текста с английского на русский:
Этот ответ ДОЛЖЕН содержать атрибут UNKNOWN-ATTRIBUTES, перечисляющий атрибуты со значениями меньше или равными 0x7fff, которые не были поняты. Ответ с ошибкой привязки отправляется на IP-адрес и порт, откуда пришел запрос на привязку, и отправляется с IP-адреса и порта, на которые был отправлен запрос на привязку.
Если запрос был сформирован правильно, сервер ДОЛЖЕН сгенерировать единичный ответ на привязку. Ответ на привязку ДОЛЖЕН содержать тот же идентификатор транзакции, что и в запросе на привязку. Длина в заголовке сообщения ДОЛЖНА содержать общую длину сообщения в байтах, исключая заголовок. Ответ на привязку ДОЛЖЕН иметь тип сообщения "Binding Response" (ответ на привязку).
Сервер ДОЛЖЕН добавить атрибут MAPPED-ADDRESS в ответ на привязку. Компонент IP-адреса этого атрибута ДОЛЖЕН быть установлен на исходный IP-адрес, наблюдаемый в запросе на привязку. Компонент порта этого атрибута ДОЛЖЕН быть установлен на исходный порт, наблюдаемый в запросе на привязку.
- User
Let Da represent the destination IP address of the Binding Request (which will be either A1 or A2), and Dp represent the destination port of the Binding Request (which will be either P1 or P2). Let Ca represent the other address, so that if Da is A1, Ca is A2. If Da is A2, Ca is A1. Similarly, let Cp represent the other port, so that if Dp is P1, Cp is P2. If Dp is P2, Cp is P1. If the "change port" flag was set in CHANGE-REQUEST attribute of the Binding Request, and the "change IP" flag was not set, the source IP address of the Binding Response MUST be Da and the source port of the Binding Response MUST be Cp. If the "change IP" flag was set in the Binding Request, and the "change port" flag was not set, the source IP address of the Binding Response MUST be Ca and the source port of the Binding Response MUST be Dp. When both flags are set, the source IP address of the Binding Response MUST be Ca and the source port of the Binding Response MUST be Cp. If neither flag is set, or if the CHANGE-REQUEST attribute is absent entirely, the source IP address of the Binding Response MUST be Da and the source port of the Binding Response MUST be Dp.
- Assistant
Вот перевод текста с английского на русский:
Пусть Da представляет IP-адрес назначения запроса на привязку (который будет либо A1, либо A2), а Dp представляет порт назначения запроса на привязку (который будет либо P1, либо P2). Пусть Ca представляет другой адрес, так что если Da — это A1, то Ca — это A2. Если Da — это A2, то Ca — это A1. Аналогично, пусть Cp представляет другой порт, так что если Dp — это P1, то Cp — это P2. Если Dp — это P2, то Cp — это P1. Если флаг "change port" (изменить порт) был установлен в атрибуте CHANGE-REQUEST (запрос изменения) запроса на привязку, и флаг "change IP" (изменить IP) не был установлен, IP-адрес источника ответа на привязку ДОЛЖЕН быть Da, а порт источника ответа на привязку ДОЛЖЕН быть Cp. Если флаг "change IP" был установлен в запросе на привязку, и флаг "change port" не был установлен, IP-адрес источника ответа на привязку ДОЛЖЕН быть Ca, а порт источника ответа на привязку ДОЛЖЕН быть Dp. Когда оба флага установлены, IP-адрес источника ответа на привязку ДОЛЖЕН быть Ca, а порт источника ответа на привязку ДОЛЖЕН быть Cp. Если ни один из флагов не установлен, или если атрибут CHANGE-REQUEST полностью отсутствует, IP-адрес источника ответа на привязку ДОЛЖЕН быть Da, а порт источника ответа на привязку ДОЛЖЕН быть Dp.
- User
The server MUST add a SOURCE-ADDRESS attribute to the Binding Response, containing the source address and port used to send the Binding Response.
The server MUST add a CHANGED-ADDRESS attribute to the Binding Response. This contains the source IP address and port that would be used if the client had set the "change IP" and "change port" flags in the Binding Request. As summarized in Table 1, these are Ca and Cp, respectively, regardless of the value of the CHANGE-REQUEST flags.
If the Binding Request contained both the USERNAME and MESSAGE- INTEGRITY attributes, the server MUST add a MESSAGE-INTEGRITY attribute to the Binding Response. The attribute contains an HMAC [13] over the response, as described in Section 11.2.8. The key to use depends on the shared secret mechanism. If the STUN Shared Secret Request was used, the key MUST be the one associated with the USERNAME attribute present in the Binding Request.
- Assistant
Вот перевод текста с английского на русский:
Сервер ДОЛЖЕН добавить атрибут SOURCE-ADDRESS в ответ на привязку, содержащий исходный адрес и порт, использованные для отправки ответа на привязку.
Сервер ДОЛЖЕН добавить атрибут CHANGED-ADDRESS в ответ на привязку. Этот атрибут содержит исходный IP-адрес и порт, которые будут использованы, если клиент установил флаги "change IP" и "change port" в запросе на привязку. Как обобщено в Таблице 1, это соответственно Ca и Cp, независимо от значений флагов CHANGE-REQUEST.
Если запрос на привязку содержал атрибуты USERNAME и MESSAGE-INTEGRITY, сервер ДОЛЖЕН добавить атрибут MESSAGE-INTEGRITY в ответ на привязку. Этот атрибут содержит HMAC, рассчитанный по ответу, как описано в разделе 11.2.8. Ключ для использования зависит от механизма общего секрета. Если использовался запрос STUN Shared Secret, ключ ДОЛЖЕН быть тем, который связан с атрибутом USERNAME, присутствующим в запросе на привязку.
- User
A Binding Request formulated by the client follows the syntax rules defined in Section 11. Any two requests that are not bit-wise identical, and not sent to the same server from the same IP address and port, MUST carry different transaction IDs. The transaction ID MUST be uniformly and randomly distributed between 0 and 2**128 - 1. The large range is needed because the transaction ID serves as a form of randomization, helping to prevent replays of previously signed responses from the server. The message type of the request MUST be "Binding Request".
- Assistant
- User
This section presents the detailed encoding of a STUN message.
STUN is a request-response protocol. Clients send a request, and the server sends a response. There are two requests, Binding Request, and Shared Secret Request. The response to a Binding Request can either be the Binding Response or Binding Error Response. The response to a Shared Secret Request can either be a Shared Secret Response or a Shared Secret Error Response.
STUN messages are encoded using binary fields. All integer fields are carried in network byte order, that is, most significant byte (octet) first. This byte order is commonly known as big-endian. The transmission order is described in detail in Appendix B of RFC 791 [6]. Unless otherwise noted, numeric constants are in decimal (base 10).
- Assistant
Вот перевод текста с английского на русский:
Этот раздел представляет детализированное кодирование сообщения STUN.
STUN — это протокол запроса-ответа. Клиенты отправляют запрос, и сервер отправляет ответ. Существует два запроса: запрос на привязку (Binding Request) и запрос общего секрета (Shared Secret Request). Ответ на запрос на привязку может быть либо ответом на привязку (Binding Response), либо ответом с ошибкой привязки (Binding Error Response). Ответ на запрос общего секрета может быть либо ответом с общим секретом (Shared Secret Response), либо ответом с ошибкой общего секрета (Shared Secret Error Response).
Сообщения STUN кодируются с использованием двоичных полей. Все целочисленные поля передаются в сетевом порядке байтов, то есть сначала старший значащий байт (октет). Такой порядок байтов обычно известен как big-endian. Порядок передачи подробно описан в Приложении B RFC 791. Если не указано иное, числовые константы представлены в десятичной системе (основание 10).
- User
The Message Types can take on the following values:
0x0001 : Binding Request 0x0101 : Binding Response 0x0111 : Binding Error Response 0x0002 : Shared Secret Request 0x0102 : Shared Secret Response 0x0112 : Shared Secret Error ResponseThe message length is the count, in bytes, of the size of the message, not including the 20 byte header.
The transaction ID is a 128 bit identifier. It also serves as salt to randomize the request and the response. All responses carry the same identifier as the request they correspond to.
- Assistant
Вот перевод текста с английского на русский:
Типы сообщений могут принимать следующие значения:
- 0x0001 : Запрос на привязку (Binding Request)
- 0x0101 : Ответ на привязку (Binding Response)
- 0x0111 : Ответ с ошибкой привязки (Binding Error Response)
- 0x0002 : Запрос общего секрета (Shared Secret Request)
- 0x0102 : Ответ с общим секретом (Shared Secret Response)
- 0x0112 : Ответ с ошибкой общего секрета (Shared Secret Error Response)
Длина сообщения — это количество байт, составляющих размер сообщения, не включая заголовок в 20 байт.
Идентификатор транзакции — это 128-битный идентификатор. Он также служит солью для рандомизации запроса и ответа. Все ответы содержат тот же идентификатор, что и соответствующий им запрос.
- User
After the header are 0 or more attributes. Each attribute is TLV encoded, with a 16 bit type, 16 bit length, and variable value:
...
The following types are defined:
0x0001: MAPPED-ADDRESS 0x0002: RESPONSE-ADDRESS 0x0003: CHANGE-REQUEST 0x0004: SOURCE-ADDRESS 0x0005: CHANGED-ADDRESS 0x0006: USERNAME 0x0007: PASSWORD 0x0008: MESSAGE-INTEGRITY 0x0009: ERROR-CODE 0x000a: UNKNOWN-ATTRIBUTES 0x000b: REFLECTED-FROM
To allow future revisions of this specification to add new attributes if needed, the attribute space is divided into optional and mandatory ones. Attributes with values greater than 0x7fff are optional, which means that the message can be processed by the client or server even though the attribute is not understood. Attributes with values less than or equal to 0x7fff are mandatory to understand, which means that the client or server cannot process the message unless it understands the attribute.
The MESSAGE-INTEGRITY attribute MUST be the last attribute within a message. Any attributes that are known, but are not supposed to be present in a message (MAPPED-ADDRESS in a request, for example) MUST be ignored.
Table 2 indicates which attributes are present in which messages. An M indicates that inclusion of the attribute in the message is mandatory, O means its optional, C means it's conditional based on some other aspect of the message, and N/A means that the attribute is not applicable to that message type.
- Assistant
Вот перевод текста с английского на русский:
После заголовка могут следовать 0 или более атрибутов. Каждый атрибут кодируется в формате TLV (тип-длина-значение), с 16-битным типом, 16-битной длиной и переменным значением:
Следующие типы определены:
- 0x0001: MAPPED-ADDRESS
- 0x0002: RESPONSE-ADDRESS
- 0x0003: CHANGE-REQUEST
- 0x0004: SOURCE-ADDRESS
- 0x0005: CHANGED-ADDRESS
- 0x0006: USERNAME
- 0x0007: PASSWORD
- 0x0008: MESSAGE-INTEGRITY
- 0x0009: ERROR-CODE
- 0x000a: UNKNOWN-ATTRIBUTES
- 0x000b: REFLECTED-FROM
Чтобы позволить будущим редакциям данной спецификации добавлять новые атрибуты, если это необходимо, пространство атрибутов делится на необязательные и обязательные. Атрибуты со значениями больше 0x7fff являются необязательными, что значит, что сообщение может быть обработано клиентом или сервером, даже если атрибут не понят. Атрибуты со значениями меньше или равными 0x7fff являются обязательными для понимания, что значит, что клиент или сервер не могут обработать сообщение, пока не поймут атрибут.
- User
The length refers to the length of the value element, expressed as an unsigned integral number of bytes
- Assistant
Вот перевод текста с английского на русский:
Длина относится к длине элемента значения, выраженной как беззнаковое целое число байт.
- User
STUN messages are encoded in binary using network-oriented format (most significant byte or octet first, also commonly known as big- endian). The transmission order is described in detail in Appendix B of RFC 791 [RFC0791]. Unless otherwise noted, numeric constants are in decimal (base 10).
All STUN messages MUST start with a 20-byte header followed by zero or more Attributes. The STUN header contains a STUN message type, magic cookie, transaction ID, and message length.
- Assistant
Вот перевод текста с английского на русский:
Сообщения STUN кодируются в двоичном формате с использованием сетевого формата (сначала передается старший значащий байт или октет, также известный как big-endian). Порядок передачи подробно описан в Приложении B RFC 791 [RFC0791]. Если не указано иное, числовые константы выражены в десятичной системе (основание 10).
Все сообщения STUN ДОЛЖНЫ начинаться с 20-байтового заголовка, за которым следуют ноль или более атрибутов. Заголовок STUN содержит тип сообщения STUN, магическое число (magic cookie), идентификатор транзакции и длину сообщения.
- User
The most significant 2 bits of every STUN message MUST be zeroes. This can be used to differentiate STUN packets from other protocols when STUN is multiplexed with other protocols on the same port.
The message type defines the message class (request, success response, failure response, or indication) and the message method (the primary function) of the STUN message. Although there are four message classes, there are only two types of transactions in STUN: request/response transactions (which consist of a request message and a response message) and indication transactions (which consist of a single indication message). Response classes are split into error and success responses to aid in quickly processing the STUN message.
- Assistant
Вот перевод текста с английского на русский:
Два старших значащих бита каждого сообщения STUN ДОЛЖНЫ быть нулями. Это может использоваться для различения пакетов STUN от других протоколов, когда STUN мультиплексируется с другими протоколами на одном и том же порту.
Тип сообщения определяет класс сообщения (запрос, успешный ответ, ответ с ошибкой или индикация) и метод сообщения (основную функцию) сообщения STUN. Хотя существует четыре класса сообщений, в STUN есть только два типа транзакций: транзакции запрос/ответ (которые состоят из сообщения запроса и сообщения ответа) и транзакции индикации (которые состоят из единственного сообщения индикации). Классы ответов разбиты на ответы с ошибкой и успешные ответы для облегчения быстрой обработки сообщения STUN.
- User
Here the bits in the message type field are shown as most significant (M11) through least significant (M0). M11 through M0 represent a 12- bit encoding of the method. C1 and C0 represent a 2-bit encoding of the class. A class of 0b00 is a request, a class of 0b01 is an indication, a class of 0b10 is a success response, and a class of 0b11 is an error response. This specification defines a single method, Binding. The method and class are orthogonal, so that for each method, a request, success response, error response, and indication are possible for that method. Extensions defining new methods MUST indicate which classes are permitted for that method.
For example, a Binding request has class=0b00 (request) and method=0b000000000001 (Binding) and is encoded into the first 16 bits as 0x0001. A Binding response has class=0b10 (success response) and method=0b000000000001, and is encoded into the first 16 bits as 0x0101.
Note: This unfortunate encoding is due to assignment of values in [RFC3489] that did not consider encoding Indications, Success, and Errors using bit fields. - Assistant
Вот перевод текста с английского на русский:
Здесь биты в поле типа сообщения показаны от самого значащего (M11) до наименее значащего (M0). Биты M11 через M0 представляют 12-битное кодирование метода. Биты C1 и C0 представляют 2-битное кодирование класса. Класс 0b00 — это запрос, класс 0b01 — индикация, класс 0b10 — успешный ответ, и класс 0b11 — ответ с ошибкой. Эта спецификация определяет один метод — привязка (Binding). Метод и класс ортогональны, так что для каждого метода возможны запрос, успешный ответ, ответ с ошибкой и индикация. Расширения, определяющие новые методы, ДОЛЖНЫ указывать, какие классы разрешены для этого метода.
Например, запрос на привязку имеет класс=0b00 (запрос) и метод=0b000000000001 (привязка) и кодируется в первые 16 бит как 0x0001. Ответ на привязку имеет класс=0b10 (успешный ответ) и метод=0b000000000001 и кодируется в первые 16 бит как 0x0101.
Примечание: Это неудачное кодирование связано с присвоением значений в [RFC3489], которое не учитывало кодирование индикаций, успешных ответов и ошибок с использованием битовых полей.
- User
The transaction ID is a 96-bit identifier, used to uniquely identify STUN transactions. For request/response transactions, the transaction ID is chosen by the STUN client for the request and echoed by the server in the response. For indications, it is chosen by the agent sending the indication. It primarily serves to correlate requests with responses, though it also plays a small role in helping to prevent certain types of attacks. The server also uses the transaction ID as a key to identify each transaction uniquely across all clients. As such, the transaction ID MUST be uniformly and randomly chosen from the interval 0 .. 2**96-1, and SHOULD be cryptographically random. Resends of the same request reuse the same transaction ID, but the client MUST choose a new transaction ID for new transactions unless the new request is bit-wise identical to the previous request and sent from the same transport address to the same IP address. Success and error responses MUST carry the same transaction ID as their corresponding request. When an agent is acting as a STUN server and STUN client on the same port, the transaction IDs in requests sent by the agent have no relationship to the transaction IDs in requests received by the agent.
- Assistant
Вот перевод текста с английского на русский:
Идентификатор транзакции — это 96-битный идентификатор, используемый для уникального определения транзакций STUN. Для транзакций запроса/ответа идентификатор транзакции выбирается STUN-клиентом для запроса и повторяется сервером в ответе. Для индикаций он выбирается агентом, отправляющим индикацию. Его основная цель — сопоставление запросов с ответами, хотя он также играет небольшую роль в предотвращении определенных типов атак. Сервер также использует идентификатор транзакции в качестве ключа для уникальной идентификации каждой транзакции среди всех клиентов. Поэтому идентификатор транзакции ДОЛЖЕН быть равномерно и случайно выбран из интервала от 0 до 2**96-1 и ДОЛЖЕН быть криптографически случайным. Повторные отправки одного и того же запроса повторно используют тот же идентификатор транзакции, но клиент ДОЛЖЕН выбирать новый идентификатор транзакции для новых транзакций, если только новый запрос не является побитово идентичным предыдущему запросу и не отправлен с того же транспортного адреса на тот же IP-адрес. Успешные и ошибочные ответы ДОЛЖНЫ содержать тот же идентификатор транзакции, что и их соответствующий запрос. Когда агент действует как STUN-сервер и STUN-клиент на одном и том же порту, идентификаторы транзакций в запросах, отправленных агентом, не имеют отношения к идентификаторам транзакций в запросах, полученных агентом.
- User
The MAPPED-ADDRESS attribute indicates the mapped IP address and port. It consists of an eight bit address family, and a sixteen bit port, followed by a fixed length value representing the IP address.
- Assistant
Вот перевод текста с английского на русский:
Атрибут MAPPED-ADDRESS указывает отображаемый IP-адрес и порт. Он состоит из восьмибитного семейства адресов и шестнадцатибитного порта, за которыми следует фиксированной длины значение, представляющее IP-адрес.
- User
The port is a network byte ordered representation of the mapped port. The address family is always 0x01, corresponding to IPv4. The first 8 bits of the MAPPED-ADDRESS are ignored, for the purposes of aligning parameters on natural boundaries. The IPv4 address is 32 bits.
- Assistant
Вот перевод текста с английского на русский:
Порт представлен в сетевом порядке байтов как отображаемый порт. Семейство адресов всегда 0x01, что соответствует IPv4. Первые 8 бит атрибута MAPPED-ADDRESS игнорируются для целей выравнивания параметров по естественным границам. IPv4-адрес занимает 32 бита.
- User
Set a timeout on blocking socket operations. The value argument can be a nonnegative floating-point number expressing seconds, or None. If a non-zero value is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. If zero is given, the socket is put in non-blocking mode. If None is given, the socket is put in blocking mode.
- Assistant
Вот перевод текста с английского на русский:
Установите тайм-аут для блокирующих операций с сокетами. Аргумент value (значение) может быть неотрицательным числом с плавающей запятой, выражающим количество секунд, или None. Если указано ненулевое значение, последующие операции с сокетами вызовут исключение тайм-аута, если время, установленное для тайм-аута, истечет до завершения операции. Если задано значение ноль, сокет переводится в неблокирующий режим. Если задано значение None, сокет переводится в блокирующий режим.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.