Skip to content

Commit

Permalink
Adding RAW socket support
Browse files Browse the repository at this point in the history
  • Loading branch information
ccie18643 committed Sep 17, 2024
1 parent 717f009 commit d064a90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytcp/socket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def socket(

from pytcp.socket.tcp__socket import TcpSocket
from pytcp.socket.udp__socket import UdpSocket
from pytcp.socket.raw__socket import RawSocket

match type, protocol:
case SocketType.STREAM, None | IpProto.TCP:
Expand All @@ -87,8 +88,8 @@ def socket(
case SocketType.DGRAM, IpProto.ICMP4 | IpProto.ICMP6:
raise NotImplementedError

case SocketType.RAW, IpProto.ICMP4 | IpProto.ICMP6:
raise NotImplementedError
case SocketType.RAW, _:
return RawSocket(address_family=family, ip_proto=protocol)

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

0 comments on commit d064a90

Please sign in to comment.