Skip to content

Conversation

@swhitty
Copy link
Owner

@swhitty swhitty commented Nov 21, 2024

After some recent refactoring we can now get and set the packetInfo via the existing the existing protocol SocketOption / setValue() API.

UDP sockets still enable these options by default within .init() but users can now easily read and change the values like so:

let socket = try Socket(domain: AF_INET, type: .datagram)
try socket.getValue(for: .packetInfoIP) == true

try socket.setValue(false, for: .packetInfoIP)
try socket.getValue(for: .packetInfoIP) == false

Unit tests have been added to cover this case.

@codecov
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (8a5f9c7) to head (a194c23).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
+ Coverage   90.02%   90.16%   +0.13%     
==========================================
  Files          60       60              
  Lines        3951     3946       -5     
==========================================
+ Hits         3557     3558       +1     
+ Misses        394      388       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@swhitty swhitty merged commit 43e8be7 into main Nov 21, 2024
16 checks passed
@swhitty swhitty deleted the datagram-tests branch November 22, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants