mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Implement raw connection
This commit is contained in:
@ -0,0 +1,10 @@
|
|||||||
|
from .raw_connection import IRawConnection
|
||||||
|
|
||||||
|
class RawConnection(IRawConnection):
|
||||||
|
|
||||||
|
def __init__(self, ip, port):
|
||||||
|
self.ip = ip
|
||||||
|
self.port = port
|
||||||
|
|
||||||
|
async def open_connection(self):
|
||||||
|
self.reader, self.writer = await asyncio.open_connection(self.ip, self.port)
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
class IRawConnection(ABC):
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def __init__(self, ip, port):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
async def open_connection(self):
|
||||||
|
pass
|
||||||
|
|
||||||
Reference in New Issue
Block a user