Feat(Apple): Add the LOCAL_PEERTOKEN socket option
Dear maintainers,
This proposes to add the Darwin-only LOCAL_PEERTOKEN constant as a new API. It is a getsockopt option variant that enables retrieving the connected peer's audit token, which enables uniquely identifying the process with respect to the underlying system. It is taken from XNU's sys/un.h header.
Regarding a justification of a use case, this would be for reliably authenticating a peer process that attempts to communicate with the current one after connecting to one of its opened sockets. However, due to it being a simple constant, this is not strictly-speaking necessary. This should therefore be seen as more of an upstreaming and contributing to complete the already-existing APIs as all the other LOCAL_PEER* constants are already included.
One thing this also does in addition is to add the small descriptions from the header as documentation comments in the Rust module, since I could see it was done from time to time, although not always. It is also done for the other similar constants, for completion's sake. If needed, this can be restricted to only LOCAL_PEERTOKEN or even removed entirely.
Cheers, Paul.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks.
Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:
@rustbot author: the review is finished, PR author should check the comments and take action accordingly@rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
@rustbot label stable-nominated
seems appropriate?
Cool, thanks! Should I open a PR for the backport to 0.2 myself or will it be done soon anyway?
Before doing a release I go through and cherry pick the backports, nothing for you to do :)