Repository navigation
feat(xpp): add SocketAddr type system, remove unused Error - #202
Merged
Merged
Conversation
Add xpp::net::{Ipv4Addr, Ipv6Addr, IpAddr, SocketAddrV4, SocketAddrV6,
SocketAddr} — 6 types mirroring Rust's std::net. Trivially copyable
value types with parse/to_string/from_sockaddr/to_sockaddr interop.
Typed error handling (Tokio-style): AddrParseError enum replaces the
generic Error(int) for address parsing. Error(int) was unused outside
net/addr and is removed; error.h deleted. cxx11_guard updated.
66 unit tests covering construction, parsing, formatting, queries,
comparison, and sockaddr round-trip.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xpp::net::{Ipv4Addr, Ipv6Addr, IpAddr, SocketAddrV4, SocketAddrV6, SocketAddr}— 6 types mirroring Rust'sstd::netIpv4Addr(4B),Ipv6Addr(16B),SocketAddrV4(8B),SocketAddrV6(28B)IpAddr/SocketAddruseVariantfor the V4/V6 sum typeparse()viainet_pton,to_string()viainet_ntop,from_sockaddr()/to_sockaddr()for C-layer interopAddrParseErrorenum withInvalidIpv4/InvalidIpv6/InvalidPort/InvalidFormatError(int)type anderror.h— onlynet/addrused it, now replaced byAddrParseErrorcxx11_guard.cppto useResult<void, int>instead ofResult<void, Error>Test plan
ctest -R xppin build (C++14)ctest -R xppin build-cxx20 (C++20)🤖 Generated with Claude Code