Editing XEP-0065: SOCKS5 Bytestreams
From JaWiki (Jabber/XMPP wiki)
Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.
The administrator who locked it offered this explanation: MediaWiki upgrading
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 5: | Line 5: | ||
{{warning|Этот текст не является официальным переводом документа [http://www.xmpp.org/extensions/xep-0065.html XEP-0065: SOCKS5 Bytestreams] и может не соответствовать оригиналу. Для разработки программ используйте официальный текст.}} | {{warning|Этот текст не является официальным переводом документа [http://www.xmpp.org/extensions/xep-0065.html XEP-0065: SOCKS5 Bytestreams] и может не соответствовать оригиналу. Для разработки программ используйте официальный текст.}} | ||
− | Этот документ определяет [[XEP|расширение протокола XMPP]] для установление [[out | + | Этот документ определяет [[XEP|расширение протокола XMPP]] для установление [[out of band|внеканального]] байтового потока между двумя произвольными [[entity|сущностями]] Jabber. |
− | : '''ПРИМЕЧАНИЕ:''' Настоящий протокол | + | : '''ПРИМЕЧАНИЕ:''' Настоящий протокол является [[Draft Standard|Черновым Стандартом]] [[XMPP Standards Foundation|Организации Стандартизации XMPP]]. Его реализации поощряются, и протокол подходит для развёртывания в производственных системах<!-- Implementations are encouraged and the protocol is appropriate for deployment in production systems -->, но прежде, чем он станет [[Final Standard|Окончательным Стандартом]], в протоколе могут произойти некоторые изменения. |
= Входные данные = | = Входные данные = | ||
− | == | + | == Document Information == |
− | + | Series: XEP | |
− | + | Number: 0065 | |
− | + | Publisher: XMPP Standards Foundation | |
− | + | Status: Draft | |
− | + | Type: Standards Track | |
− | + | Version: 1.7 | |
− | + | Last Updated: 2007-05-21 | |
− | + | Approving Body: XMPP Council | |
− | + | Dependencies: XMPP Core, RFC 1928, RFC 3174, XEP-0030 | |
− | + | Supersedes: None | |
− | + | Superseded By: None | |
− | + | Short Name: bytestreams | |
− | + | Schema: <http://www.xmpp.org/schemas/bytestreams.xsd> | |
− | + | Wiki Page: <http://wiki.jabber.org/index.php/SOCKS5 Bytestreams (XEP-0065)> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | == | + | == Author Information == |
− | + | === Dave Smith === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Email: dizzyd@jabber.org | |
+ | JabberID: dizzyd@jabber.org | ||
− | + | === Matthew Miller === | |
− | + | Email: linuxwolf@outer-planes.net | |
+ | JabberID: linuxwolf@outer-planes.net | ||
− | == | + | === Peter Saint-Andre === |
− | + | Email: stpeter@jabber.org | |
+ | JabberID: stpeter@jabber.org | ||
− | + | == Legal Notice == | |
− | + | This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>). | |
− | + | == Discussion Venue == | |
− | + | The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>. | |
− | + | Given that this XMPP Extension Protocol normatively references IETF technologies, discussion on the XSF-IETF list may also be appropriate (see <http://mail.jabber.org/mailman/listinfo/jsf-ietf> for details). | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | = | + | == Relation to XMPP == |
− | == | + | The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself. |
+ | |||
+ | == Conformance Terms == | ||
+ | |||
+ | The following keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL". | ||
+ | |||
+ | = Описание протокола = | ||
− | + | == Introduction == | |
− | + | ||
− | + | ||
− | + | ||
− | + | XMPP is designed for sending relatively small fragments of XML between network entities (see XMPP Core [1]) and is not designed for sending binary data. However, sometimes it is desirable to send binary data to another entity that one has discovered on the XMPP network (e.g., to send a file). Therefore it is widely recognized within the Jabber community that it would be valuable to have a generic protocol for streaming binary data between any two entities on the network. The main application for such a bytestreaming technology would be file transfer, for which there are currently a number of incompatible protocols (resulting in a lack of interoperability). However, other applications are possible, which is why it is important to develop a generic protocol rather than one that is specialized for a particular application such as file transfer. This document defines a protocol that meets the following conditions: | |
+ | Bytestreams are established over standard TCP connections (RFC 793 [2]) or UDP associations (RFC 768 [3]), where TCP support is REQUIRED and UDP support is OPTIONAL | ||
+ | Sockets may be direct (peer-to-peer) or mediated (established through a bytestreaming service) | ||
+ | Where possible, standard wire protocols are used | ||
− | + | Specifically, this document proposes that the Jabber community make use of the SOCKS 5 protocol, which is an IETF-approved, IPv6-ready technology for bytestreams. (Note: Because this proposal uses a subset of the SOCKS5 protocol that is specially adapted for Jabber bytestreams, existing SOCKS5 proxies cannot be used to implement this proposal without modifications.) | |
− | + | == Terminology == | |
− | + | The following terms are used throughout this document. | |
− | + | Table 1: Glossary of EntitiesTerm Description | |
− | + | Initiator A Jabber Entity that wishes to establish a bytestream with another Entity | |
− | + | Target The Entity with which the Initiator is attempting to establish a bytestream | |
− | + | Proxy A Jabber entity which is not NAT/Firewalled and is willing to be a middleman for the bytestream between the Initiator and the Target | |
− | + | StreamHost The system that the Target connects to and that is "hosting" the bytestream -- may be either the Initiator or a Proxy | |
− | + | StreamID A relatively unique Stream ID for this connection; this is generated by the Initiator for tracking purposes and MUST be less than 128 characters in length | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Narrative == | == Narrative == | ||
− | |||
− | + | There are two scenarios addressed by this protocol: | |
− | + | direct connection (i.e., the StreamHost is the Initiator) | |
− | + | mediated connection (i.e., the StreamHost is a Proxy) | |
− | + | The "happy paths" for these scenarios are described separately below for ease of understanding. A full description of these scenarios is captured in the Formal Use Case. This narrative describes TCP connections only; UDP associations are described in the Optional UDP Support section of this document. | |
− | === | + | === Direct Connection === |
− | + | Direct connection is the simpler case. In this situation, the StreamHost is the Initiator (StreamHost/Initiator), which means that the Initiator knows the network address of the StreamHost and knows when to activate the bytestream. The process for establishing bytestreams in this case is as follows: | |
− | + | Initiator sends IQ-set to Target specifying the full JID and network address of StreamHost/Initiator as well as the StreamID (SID) of the proposed bytestream. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Target opens a TCP socket to the specified network address. | |
− | + | Target requests connection via SOCKS5, with the DST.ADDR and DST.PORT parameters set to the values defined below. | |
− | + | StreamHost/Initiator sends acknowledgement of successful connection to Target via SOCKS5. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Target sends IQ-result to Initiator, preserving the 'id' of the initial IQ-set. | |
− | + | StreamHost/Initiator activates the bytestream. | |
− | + | Initiator and Target may begin using the bytestream. | |
− | + | === Mediated Connection === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Mediated connection is slightly more complicated. In this situation, the StreamHost is not the Initiator but a Proxy, which means that the Initiator must discover the network address of the StreamHost before sending the initial IQ-set, must negotiate a connection with the StreamHost in the same way that the Target does, and must request that the StreamHost activate the bytestream before it can be used. The process for establishing bytestreams in this case is as follows: | |
− | + | Optionally, Initiator discovers the network address of StreamHost in-band. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Initiator sends IQ-set to Target specifying the full JID and network address of StreamHost as well as the StreamID (SID) of the proposed bytestream. | |
− | + | Target opens a TCP socket to the selected StreamHost. | |
− | + | Target establishes connection via SOCKS5, with the DST.ADDR and DST.PORT parameters set to the values defined below. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | StreamHost sends acknowledgement of successful connection to Target via SOCKS5. | |
− | + | Target sends IQ-result to Initiator, preserving the 'id' of the initial IQ-set. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Initiator opens a TCP socket at the StreamHost. | |
− | + | Initiator establishes connection via SOCKS5, with the DST.ADDR and DST.PORT parameters set to the values defined below. | |
− | + | StreamHost sends acknowledgement of successful connection to Initiator via SOCKS5. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Initiator sends IQ-set to StreamHost requesting that StreamHost activate the bytestream associated with the StreamID. | |
− | + | StreamHost activates the bytestream. (Data is now relayed between the two SOCKS5 connections by the proxy.) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | StreamHost sends IQ-result to Initiator acknowledging that the bytestream has been activated (or specifying an error). | |
− | + | Initiator and Target may begin using the bytestream. | |
− | + | == Protocol == | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | === Initiator Queries Target Regarding Bytestreams Support === | |
− | + | ||
− | + | ||
− | + | Before attempting to initiate a bytestream, the Initiator may want to know if the Target supports the bytestream protocol. It may do so using Service Discovery [4] as follows: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Example 1. Initiator Sends Service Discovery Request to Target | |
− | + | <iq type='get' | |
− | + | from='initiator@host1/foo' | |
− | + | to='target@host2/bar' | |
− | + | id='hello'> | |
− | + | <query xmlns='http://jabber.org/protocol/disco#info'/> | |
− | + | </iq> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | If the Target supports bytestreams, it MUST answer to that effect in the service discovery result. | |
− | + | Example 2. Target Replies to Service Discovery Request | |
− | + | <iq type='result' | |
− | + | from='target@host2/bar' | |
− | + | to='initiator@host1/foo' | |
− | + | id='hello'> | |
− | + | <query xmlns='http://jabber.org/protocol/disco#info'> | |
− | + | <identity | |
− | + | category='proxy' | |
− | + | type='bytestreams' | |
− | + | name='SOCKS5 Bytestreams Service'/> | |
+ | ... | ||
+ | <feature var='http://jabber.org/protocol/bytestreams'/> | ||
+ | ... | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
+ | === Initiator Queries Server For Proxies === | ||
− | + | Before attempting to initiate a bytestream, the Initiator needs to find a proxy. It may do so using Service Discovery as follows: | |
− | + | Example 3. Initiator Sends Service Discovery Request to Server | |
− | + | <iq type='get' | |
− | + | from='initiator@host1/foo' | |
− | + | to='host1' | |
− | + | id='server_items'> | |
− | + | <query xmlns='http://jabber.org/protocol/disco#items'/> | |
− | + | </iq> | |
− | + | ||
− | + | ||
− | + | ||
− | + | The server will return all of the known JIDs in its disco list. | |
− | + | Example 4. Server Replies to Service Discovery Request | |
+ | <iq type='result' | ||
+ | from='host1' | ||
+ | to='initiator@host1/foo' | ||
+ | id='server_items'> | ||
+ | <query xmlns='http://jabber.org/protocol/disco#items'> | ||
+ | ... | ||
+ | <item jid='proxy.host3' name='Bytestreams Proxy'/> | ||
+ | ... | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
+ | === Initiator Queries Proxy to Find Out if it is a Proxy === | ||
− | + | For each item in the disco#items result, the Initiator must query to determine if it is a bytestreams proxy. It may do so using Service Discovery as follows: | |
− | + | ||
− | + | ||
− | + | Example 5. Initiator Sends Service Discovery Request to Proxy | |
+ | <iq type='get' | ||
+ | from='initiator@host1/foo' | ||
+ | to='proxy.host3' | ||
+ | id='proxy_info'> | ||
+ | <query xmlns='http://jabber.org/protocol/disco#info'/> | ||
+ | </iq> | ||
+ | |||
− | + | The proxy will return its information. The Initiator SHOULD inspect each identity to see if it contains an identity of category "proxy" and type "bytestreams". | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Example 6. Server Replies to Service Discovery Request | |
+ | <iq type='result' | ||
+ | from='proxy.host3' | ||
+ | to='initiator@host1/foo' | ||
+ | id='proxy_info'> | ||
+ | <query xmlns='http://jabber.org/protocol/disco#info'> | ||
+ | ... | ||
+ | <identity category='proxy' | ||
+ | type='bytestreams' | ||
+ | name='SOCKS5 Bytestreams Service'/> | ||
+ | ... | ||
+ | <feature var='http://jabber.org/protocol/bytestreams'/> | ||
+ | ... | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
+ | === Initiator Discovers Network Address of StreamHost === | ||
− | + | If the StreamHost is a Proxy, the Initiator must first request the full network address used for bytestreaming (obviously this is not required if the StreamHost is the Initiator). This is done by sending an IQ-get to the proxy in the bytestreams namespace, as follows: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | === | + | Example 7. Initiator Requests Network Address from Proxy |
+ | <iq type='get' | ||
+ | from='initiator@host1/foo' | ||
+ | to='proxy.host3' | ||
+ | id='discover'> | ||
+ | <query xmlns='http://jabber.org/protocol/bytestreams'/> | ||
+ | </iq> | ||
+ | |||
− | + | The <streamhost/> element specifying a network address MUST possess the following attributes: | |
+ | jid = the JID of the StreamHost for communications over Jabber | ||
− | + | In addition, the <streamhost/> element MUST include: | |
− | + | EITHER | |
− | + | host = the hostname or IP address of the StreamHost for SOCKS5 communications over TCP | |
− | + | port = a port associated with the hostname or IP address for SOCKS5 communications over TCP | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | OR | |
+ | zeroconf = a zeroconf [5] identifier to which an entity may connect, for which the service identifier and protocol name SHOULD be "_jabber.bytestreams". | ||
− | + | Example 8. Proxy Informs Initiator of Network Address | |
+ | <iq type='result' | ||
+ | from='proxy.host3' | ||
+ | to='initiator@host1/foo' | ||
+ | id='discover'> | ||
+ | <query xmlns='http://jabber.org/protocol/bytestreams'> | ||
+ | <streamhost | ||
+ | jid='proxy.host3' | ||
+ | host='24.24.24.1' | ||
+ | zeroconf='_jabber.bytestreams'/> | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
− | + | If the Initiator does not have permissions to initiate bytestreams on the Proxy for whatever reason (e.g., a proxy implementation may enable administrators to ban JIDs or domains from using the Proxy), the Proxy MUST return a <forbidden/> error to the Initiator (for information about error syntax, refer to Error Condition Mappings [6]): | |
− | + | ||
− | + | ||
− | + | ||
− | < | + | Example 9. Proxy Returns Error to Initiator |
− | + | <iq type='error' | |
− | + | from='initiator@host1/foo' | |
− | + | to='proxy.host3' | |
− | + | id='discover'> | |
+ | <query xmlns='http://jabber.org/protocol/bytestreams'/> | ||
+ | <error code='403' type='auth'> | ||
+ | <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
+ | </error> | ||
+ | </iq> | ||
+ | |||
− | < | + | If the Proxy is unable to act as a StreamHost, the Proxy SHOULD return a <not-allowed/> error to the Initiator: |
− | + | ||
− | + | Example 10. Proxy Returns Error to Initiator | |
+ | <iq type='error' | ||
+ | from='initiator@host1/foo' | ||
+ | to='proxy.host3' | ||
+ | id='discover'> | ||
+ | <query xmlns='http://jabber.org/protocol/bytestreams'/> | ||
+ | <error code='405' type='cancel'> | ||
+ | <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
+ | </error> | ||
+ | </iq> | ||
+ | |||
+ | === Initiator Informs Target of StreamHosts === | ||
− | + | In order to establish a bytestream between the Initiator and the Target, the Initiator must provide network address information for the StreamHost(s) to the Target. This happens in-band via a single IQ-set, which must contain the following information: | |
+ | The network address of at least one StreamHost to which the Target may attempt to connect | ||
+ | The Stream ID for this connection | ||
+ | The "mode" to use, normally "tcp" but optionally "udp" (see the Optional UDP Support section of this document) | ||
− | + | The protocol format is shown below. | |
− | + | Example 11. Initiation of Interaction | |
− | + | <iq type='set' | |
− | + | from='initiator@host1/foo' | |
− | + | to='target@host2/bar' | |
− | + | id='initiate'> | |
− | + | <query xmlns='http://jabber.org/protocol/bytestreams' | |
− | <streamhost | + | sid='mySID' |
− | + | mode='tcp'> | |
− | + | <streamhost | |
+ | jid='initiator@host1/foo' | ||
+ | host='192.168.4.1' | ||
+ | port='5086'/> | ||
+ | <streamhost | ||
+ | jid='proxy.host3' | ||
+ | host='24.24.24.1' | ||
+ | zeroconf='_jabber.bytestreams'/> | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
− | + | If the Target is unwilling to accept the bytestream, it MUST return a <not-acceptable/> error to the Initiator. | |
− | === | + | Example 12. Target Refuses Bytestream |
+ | <iq type='error' | ||
+ | from='target@host2/bar' | ||
+ | to='initiator@host1/foo' | ||
+ | id='initiate'> | ||
+ | <error code='406' type='auth'> | ||
+ | <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
+ | </error> | ||
+ | </iq> | ||
+ | |||
+ | === Target Establishes SOCKS5 Connection with StreamHost === | ||
− | + | If the Target is willing to accept the bytestream, it MUST attempt to open a standard TCP socket on the network address of the StreamHost communicated by the Initiator. If the Initiator provides more than one StreamHost, the Target SHOULD try to connect to them in the order they occur. | |
+ | If the Target tries but is unable to connect to any of the StreamHosts and it does not wish to attempt a connection from its side, it MUST return a <item-not-found/> error to the Initiator. | ||
− | + | Example 13. Target Is Unable to Connect to Any StreamHost and Wishes to End Transaction | |
− | + | <iq type='error' | |
− | + | from='target@host2/bar' | |
− | + | to='initiator@host1/foo' | |
− | + | id='initiate'> | |
+ | <error code='404' type='cancel'> | ||
+ | <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
+ | </error> | ||
+ | </iq> | ||
+ | |||
+ | If the Target is able to open a TCP socket on a StreamHost, it MUST utilize the SOCKS5 protocol specified in RFC 1928 [7] to establish the connection with the StreamHost. In accordance with the SOCKS5 RFC, the Target MAY have to authenticate in order to use the proxy. However, any authentication required is beyond the scope of this document. | ||
− | + | Once the Target has successfully authenticated with the Proxy (even anonymously), it SHOULD send a CONNECT request to the appropriate host in order to continue the negotiation. The following rules apply: | |
− | + | The hostname MUST be SHA1(SID + Initiator JID + Target JID) where the definition of the SHA1 hashing algorithm is as specified by RFC 3174 [8] and the output is hexadecimal-encoded (not binary). | |
+ | The port MUST be 0 (zero). | ||
+ | The JIDs provided MUST be the JIDs used for the IQ exchange, which MAY be full JIDs (<node@domain.tld/resource>) or bare JIDs (<node@domain.tld>). | ||
+ | The appropriate stringprep profiles (as specified in XMPP Core [9]) MUST be applied to the JIDs before application of the SHA1 hashing algorithm. | ||
+ | Example 14. Target Connects to StreamHost | ||
+ | CMD = X'01' | ||
+ | ATYP = X'03' | ||
+ | DST.ADDR = SHA1 Hash of: (SID + Initiator JID + Target JID) | ||
+ | DST.PORT = 0 | ||
+ | |||
+ | |||
+ | Example 15. StreamHost Acknowledges Connection | ||
+ | STATUS = X'00' | ||
+ | |||
+ | |||
+ | When replying to the client in accordance with Section 6 of RFC 1928, the StreamHost SHOULD set the BND.ADDR and BND.PORT to the values provided by the client in the connection request. | ||
+ | |||
+ | === Target Acknowledges SOCKS5 Connection === | ||
+ | |||
+ | After the Target has authenticated with the StreamHost, it MUST send an IQ-result to the Initiator indicating which StreamHost was used. | ||
+ | |||
+ | Example 16. Target Notifies Initiator of Connection | ||
+ | <iq type='result' | ||
+ | from='target@host2/bar' | ||
+ | to='initiator@host1/foo' | ||
+ | id='initiate'> | ||
+ | <query xmlns='http://jabber.org/protocol/bytestreams'> | ||
+ | <streamhost-used jid='proxy.host3'/> | ||
+ | </query> | ||
+ | </iq> | ||
+ | |||
+ | |||
+ | At this point, the Initiator knows which StreamHost was used by the Target. | ||
+ | |||
+ | === Initiator Establishes SOCKS5 Connection with StreamHost === | ||
+ | |||
+ | If the StreamHost used is a Proxy, the Initiator MUST authenticate and establish a connection with the StreamHost before requesting that the StreamHost activate bytestream. The Initiator will establish a connection to the SOCKS5 proxy in the same way the Target did (passing the same value for the CONNECT request), as shown in the following examples. | ||
+ | |||
+ | Example 17. Initiator Connects to StreamHost | ||
+ | CMD = X'01' | ||
+ | ATYP = X'03' | ||
+ | DST.ADDR = SHA1 Hash of: (SID + Initiator JID + Target JID) | ||
+ | DST.PORT = 0 | ||
+ | |||
+ | |||
+ | Example 18. StreamHost Acknowledges Connection to Initiator | ||
+ | STATUS = X'00' | ||
+ | |||
=== Activation of Bytestream === | === Activation of Bytestream === | ||
Line 427: | Line 438: | ||
<not-allowed/> error if only one party (either Initiator or Recipient, but not both) is connected to the Proxy | <not-allowed/> error if only one party (either Initiator or Recipient, but not both) is connected to the Proxy | ||
<internal-server-error/> error if the proxy cannot activate the bytestream because of some internal malfunction | <internal-server-error/> error if the proxy cannot activate the bytestream because of some internal malfunction | ||
− | |||
== Formal Use Case == | == Formal Use Case == | ||