洋葱网络

最近看比特币相关,了解到比特币直接的p2p节点通信也支持洋葱网络,遂简单了解了下洋葱网络的通信原理。

以下用简单的描述语言总结了下,可以说基本就是利用加密套娃实现的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

客户端==》目录服务器==》中继服务器*3 公钥加密包裹
get pub_client_relay_1
client =request=> directory =return=> relay_1 addr
client =connect=> realy_1 =return=> pub_client_relay_1

get pub_relay_1_relay_2
client =request=> directory =return=> relay_2 addr
clent =request with relay_2 addr=> relay_1 =connect=> relay_2 =return=> pub_relay_1_relay_2 =return=>client

get pub_relay_2_relay_3
client =request=> directory =return=> relay_3 addr
clent =request with relay_3 addr=> relay_2 =connect=> relay_3 =return=> pub_relay_2_relay_3 =return=>client

send msg
pub_client_relay_1(pub_relay_1_relay_2(pub_relay_2_relay_3(msg)))