refactor libp2p

This commit is contained in:
zixuanzh
2018-11-25 01:45:13 -05:00
parent 5548041a37
commit ff6fdccea4
3 changed files with 26 additions and 36 deletions

View File

@ -1,14 +1,11 @@
import pytest
from libp2p.libp2p import Libp2p
from libp2p.libp2p import *
@pytest.mark.asyncio
async def test_simple_messages():
libA = Libp2p(transport_opt=["/ip4/127.0.0.1/tcp/8001/ipfs/hostA"])
libB = Libp2p(transport_opt=["/ip4/127.0.0.1/tcp/8000/ipfs/hostB"])
hostA = await libA.new_node()
hostB = await libB.new_node()
hostA = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8001/ipfs/hostA"])
hostB = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/8000/ipfs/hostB"])
async def stream_handler(stream):
while True: