洋葱网络 发表于 2021-10-26 | 分类于 note 最近看比特币相关,了解到比特币直接的p2p节点通信也支持洋葱网络,遂简单了解了下洋葱网络的通信原理。 以下用简单的描述语言总结了下,可以说基本就是利用加密套娃实现的 12345678910111213141516客户端==》目录服务器==》中继服务器*3 公钥加密包裹 get pub_client_relay_1client =request=> directory =return=> relay_1 addrclient =connect=> realy_1 =return=> pub_client_relay_1get pub_relay_1_relay_2 client =request=> directory =return=> relay_2 addrclent =request with relay_2 addr=> relay_1 =connect=> relay_2 =return=> pub_relay_1_relay_2 =return=>clientget pub_relay_2_relay_3client =request=> directory =return=> relay_3 addrclent =request with relay_3 addr=> relay_2 =connect=> relay_3 =return=> pub_relay_2_relay_3 =return=>clientsend msg pub_client_relay_1(pub_relay_1_relay_2(pub_relay_2_relay_3(msg)))