Skip to content

Commit d064a90

Browse files
committed
Adding RAW socket support
1 parent 717f009 commit d064a90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytcp/socket/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def socket(
7676

7777
from pytcp.socket.tcp__socket import TcpSocket
7878
from pytcp.socket.udp__socket import UdpSocket
79+
from pytcp.socket.raw__socket import RawSocket
7980

8081
match type, protocol:
8182
case SocketType.STREAM, None | IpProto.TCP:
@@ -87,8 +88,8 @@ def socket(
8788
case SocketType.DGRAM, IpProto.ICMP4 | IpProto.ICMP6:
8889
raise NotImplementedError
8990

90-
case SocketType.RAW, IpProto.ICMP4 | IpProto.ICMP6:
91-
raise NotImplementedError
91+
case SocketType.RAW, _:
92+
return RawSocket(address_family=family, ip_proto=protocol)
9293

9394
case _:
9495
raise ValueError("Invalid socket type.")

0 commit comments

Comments
 (0)