XEP-0065: SOCKS5 Bytestreams

[b]SOCKS5 Bytestreams ("S5B")
out-of-band bytestream[/b]

[b]Requester[/b]
The entity that starts a bytestream negotiation with a Target. [7]
[b]Target[/b]
The entity with which the Requester is attempting to establish a bytestream.
[b]Proxy[/b]
An entity that is willing to be a middleman for the bytestream between the Requester and the Target.
[b]StreamHost[/b]
The system that the Target connects to and that is "hosting" the bytestream; the Streamhost can be either the Requester or a Proxy.
[b]StreamID[/b]
A relatively unique Stream ID for this connection; this is generated by the Requester for tracking purposes and MUST be less than 128 characters in length.

* "----" ... communications over XMPP
* "____" ... communications over TCP
* "\\\\" and "" ... communications over SOCKS 5
* "====" ... communications over the bytestream itself


[b]Direct Connections[/b]
In this situation, the StreamHost is the Requester
Requester                           Target
| |
| Send S5B initiation request |
| -------------------------------> |
| |
| Open TCP socket |
| <_______________________________ |
| |
| Request SOCKS 5 connection |
| <\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
| |
| Acknowledge SOCKS 5 connection |
| ///> |
| |
| Send S5B acceptance |
| <------------------------------- |
| |
| Exchange data over S5B |
| <==============================> |
|


1. Requester Initiates S5B Negotiation
<iq from='requester@example.com/foo'
id='hu3vax16'
to='target@example.org/bar'
type='set'>
<query xmlns='http://jabber.org/protocol/bytestreams'
sid='vxf9n471bn46'>
<streamhost
jid='requester@example.com/foo'
host='192.168.4.1'
port='5086'/>
</query>
</iq>


2. the Target attempts to open a standard TCP socket on the network address of the StreamHost/Requester.

3. Target Establishes SOCKS5 Connection with StreamHost
CMD = X'01'
ATYP = X'03'
DST.ADDR = SHA1 Hash of: (SID + Requester JID + Target JID)
DST.PORT = 0


4. StreamHost Acknowledges Connection
STATUS = X'00'


5. Target Notifies Requester of Bytestream
<iq from='target@example.org/bar'
id='hu3vax16'
to='requester@example.com/foo'
type='result'>
<query xmlns='http://jabber.org/protocol/bytestreams'
sid='vxf9n471bn46'>
<streamhost-used jid='requester@example.com/foo'/>
</query>
</iq>


[b]Mediated Connections[/b]
In this situation, the StreamHost is not the Requester but a Proxy, which means that the Requester needs to discover the network address of the StreamHost before sending the initiation request to the Target, needs to negotiate a connection with the StreamHost in the same way that the Target does, and needs to ask the StreamHost to activate the bytestream before it can be used.

1. Requester Initiates Negotiation
<iq from='requester@example.com/foo'
id='npq71g53'
to='target@example.org/bar'
type='set'>
<query xmlns='http://jabber.org/protocol/bytestreams'
sid='vxf9n471bn46'>
<streamhost
host='24.24.24.1'
jid='streamer.example.com'
port='7625'/>
</query>
</iq>


2. the Target attempts to open a standard TCP socket on the network address of the Proxy.

3. Target Establishes SOCKS5 Connection with StreamHost
CMD = X'01'
ATYP = X'03'
DST.ADDR = SHA1 Hash of: (SID + Requester JID + Target JID)
DST.PORT = 0


4. StreamHost Acknowledges Connection
STATUS = X'00'


5. Target Acknowledges Bytestream
<iq from='target@example.org/bar'
id='npq71g53'
to='requester@example.com/foo'
type='result'>
<query xmlns='http://jabber.org/protocol/bytestreams'
sid='vxf9n471bn46'>
<streamhost-used jid='streamer.example.com'/>
</query>
</iq>


6. Requester Establishes SOCKS5 Connection with StreamHost
CMD = X'01'
ATYP = X'03'
DST.ADDR = SHA1 Hash of: (SID + Requester JID + Target JID)
DST.PORT = 0


7. StreamHost Acknowledges Connection to Requester
STATUS = X'00'


8. Requester Requests Activation of Bytestream
<iq from='requester@example.com/foo'
id='oqx6t1c9'
to='streamer.example.com'
type='set'>
<query xmlns='http://jabber.org/protocol/bytestreams'
sid='vxf9n471bn46'>
<activate>target@example.org/bar</activate>
</query>
</iq>


9. Proxy Informs Requester of Activation
<iq from='streamer.example.com'
id='oqx6t1c9'
to='requester@example.com/foo'
type='result'/>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值