-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement IUtf8SpanParsable
on IPAddress
and IPNetwork
#102144
Implement IUtf8SpanParsable
on IPAddress
and IPNetwork
#102144
Commits on May 6, 2024
-
Changed IP address parsers to use generics
This is preparation for the work required to enable IUtf8SpanParsable support on IPAddress and IPNetwork. Also replaced a few instances of unsafe code with spans. This uses the same style of generic constraints as the numeric parsing in corelib (although it can't access IUtfChar<TSelf>.) All tests pass, although the UTF8 code paths haven't yet been tested. Some restructuring is pending as I plumb IPAddressParser to the updated generic methods. Future commits will handle the downstream dependencies of IPvXAddressHelper - at present, this looks like Uri and TargetHostNameHelper.
Configuration menu - View commit details
-
Copy full SHA for 81ab847 - Browse repository at this point
Copy the full SHA 81ab847View commit details -
Moved generic type definitions to parser classes
This allows me to eliminate the nested class and now-redundant generic type constraints on each method
Configuration menu - View commit details
-
Copy full SHA for 2bf97eb - Browse repository at this point
Copy the full SHA 2bf97ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 223cece - Browse repository at this point
Copy the full SHA 223ceceView commit details
Commits on May 7, 2024
-
These are just the changes required to make System.Private.Uri compile. * Split IPAddressParser and IPv6AddressHelper into multiple files and shared common components between projects. * Updated some of the Uri-specific additions to IPvXAddressHelper files to use spans. * Minor adjustments to project files to support the above.
Configuration menu - View commit details
-
Copy full SHA for b9e3a62 - Browse repository at this point
Copy the full SHA b9e3a62View commit details
Commits on May 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 4e580ac - Browse repository at this point
Copy the full SHA 4e580acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ff7241 - Browse repository at this point
Copy the full SHA 8ff7241View commit details -
Configuration menu - View commit details
-
Copy full SHA for f627e44 - Browse repository at this point
Copy the full SHA f627e44View commit details -
Brief tidy-up of System.Net.Primitives ref project and csproj
Removed a using statement in the ref project, small reduction in the csproj diff for System.Net.Primitives
Configuration menu - View commit details
-
Copy full SHA for 1f52945 - Browse repository at this point
Copy the full SHA 1f52945View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3710a7a - Browse repository at this point
Copy the full SHA 3710a7aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f4968c - Browse repository at this point
Copy the full SHA 1f4968cView commit details -
Configuration menu - View commit details
-
Copy full SHA for ed8c666 - Browse repository at this point
Copy the full SHA ed8c666View commit details
Commits on Jun 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3c6e190 - Browse repository at this point
Copy the full SHA 3c6e190View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea95067 - Browse repository at this point
Copy the full SHA ea95067View commit details
Commits on Jun 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for d478e82 - Browse repository at this point
Copy the full SHA d478e82View commit details
Commits on Jun 22, 2024
-
Removed generic type definition from classes
Moved the generic type definition from the IP*AddressParser classes to individual methods, and moved the constant-value fields to local variables. Swapped out the arrays in these constant-value fields to a ReadOnlySpan to reduce allocations. Replaced calls to TChar.CreateTruncating with TChar.CreateChecked.
Configuration menu - View commit details
-
Copy full SHA for c42c706 - Browse repository at this point
Copy the full SHA c42c706View commit details -
Replaced ref parameter with out parameter, propagated
Also made one adjustment in Uri so that it uses BinaryPrimitives to convert a long to a Span<byte>, rather than manual bit shifts.
Configuration menu - View commit details
-
Copy full SHA for 49bc3a5 - Browse repository at this point
Copy the full SHA 49bc3a5View commit details
Commits on Jun 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3378947 - Browse repository at this point
Copy the full SHA 3378947View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66ec8c2 - Browse repository at this point
Copy the full SHA 66ec8c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for afdee99 - Browse repository at this point
Copy the full SHA afdee99View commit details -
Code review feedback: initial work
Renamed bytesConsumed parameter to charsConsumed. `IPNetwork.TryParse(ReadOnlySpan<byte>, IPNetwork)` now finds the last index of a '/' rather than the first. This syncs its behaviour with the `ReadOnlySpan<char>` equivalent. Removed unnecessary type constraints which lingered after the removal of the class-level generic type constraint.
Configuration menu - View commit details
-
Copy full SHA for 043120f - Browse repository at this point
Copy the full SHA 043120fView commit details -
Removed unnecessary lastSequence modification
This is only used when handling an IPv4 address embedded inside an IPv6 address, but this can only appear once, so the modification is unnecessary
Configuration menu - View commit details
-
Copy full SHA for c593694 - Browse repository at this point
Copy the full SHA c593694View commit details
Commits on Jul 2, 2024
-
* Completed rename process of bytesConsumed to charsConsumed. * Replaced remaining reference of TChar.CreateChecked with CreateTruncating. * Removed unnecessary nullability annotation. * Formatting change
Configuration menu - View commit details
-
Copy full SHA for 4aff60e - Browse repository at this point
Copy the full SHA 4aff60eView commit details
Commits on Jul 4, 2024
-
Optimisations to IPv[4/6]AddressHelper
* Removed use of helper method for number parsing. * Removed redundant check of parts[0] in IPv4AddressHelper. * Added basic heuristic to IPv6AddressHelper to avoid searching for an embedded IPv4 address if the string doesn't contain a '.'.
Configuration menu - View commit details
-
Copy full SHA for 8c41d9b - Browse repository at this point
Copy the full SHA 8c41d9bView commit details -
Cleaned up IPAddressParser.Common.cs
IPAddressParser.Common.cs is no longer needed. This should also clean up the PR diff
Configuration menu - View commit details
-
Copy full SHA for 64c639c - Browse repository at this point
Copy the full SHA 64c639cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f290a3a - Browse repository at this point
Copy the full SHA f290a3aView commit details
Commits on Jul 6, 2024
-
Testing micro-optimisations in IPv4 address parser
* Slightly reducing memory usage by storing the parts as uints. * Removing unnecessary assignment of the maximum digit value for octal, deferring another. * Removed case-insensitivity in the hexadecimal parsing. * Remove unnecessary bitmasks in final assembly of address - values have already been verified as < 0xFF.
Configuration menu - View commit details
-
Copy full SHA for 65027db - Browse repository at this point
Copy the full SHA 65027dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for cd73915 - Browse repository at this point
Copy the full SHA cd73915View commit details -
Configuration menu - View commit details
-
Copy full SHA for 385ee62 - Browse repository at this point
Copy the full SHA 385ee62View commit details -
Configuration menu - View commit details
-
Copy full SHA for f7d4298 - Browse repository at this point
Copy the full SHA f7d4298View commit details
Commits on Jul 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cb1d208 - Browse repository at this point
Copy the full SHA cb1d208View commit details -
Additional optimisations post-benchmark
* Hoisted a condition out of its loop. * Switched from a series of comparisons when validating a hex digit to a simple table lookup. * Adjusted IPv6AddressHelper.Parse to eliminate range checks on the components. Nothing reaches .Parse without being validated, so there's no overflow risk here.
Configuration menu - View commit details
-
Copy full SHA for 0f3bbaf - Browse repository at this point
Copy the full SHA 0f3bbafView commit details
Commits on Jul 17, 2024
-
Mostly in the IPv6 parsing. * Removed HexConverter, which adds a little more latency than expected. * For short (<= 16) IPv6 addresses, ROS.Contains and ROS.IndexOf are more expensive than iterating over each character.
Configuration menu - View commit details
-
Copy full SHA for 1f8a166 - Browse repository at this point
Copy the full SHA 1f8a166View commit details -
Style/comment changes to IPv4AddressHelper. Swapped IPv6AddressHelper back to the previous switch block.
Configuration menu - View commit details
-
Copy full SHA for 21f1f86 - Browse repository at this point
Copy the full SHA 21f1f86View commit details
Commits on Jul 20, 2024
-
Initial response to newest review
* Removed references to unchecked. * Changed numeric character detection to align with char.IsAsciiDigit. * Changed hex character detection to use HexConverter. * Cosmetic change: reordered if-condition and changed comment to match - slightly cleans up diff. * Cosmetic change: line spacing.
Configuration menu - View commit details
-
Copy full SHA for 70a60a5 - Browse repository at this point
Copy the full SHA 70a60a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e0c49c2 - Browse repository at this point
Copy the full SHA e0c49c2View commit details
Commits on Jul 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 94b2dd1 - Browse repository at this point
Copy the full SHA 94b2dd1View commit details -
There are now no circumstances where a string is passed to if_nametoindex or SystemNative_InterfaceNameToIndex, or the calling InterfaceNameToIndex method in InterfaceInfoPal. Removed these.
Configuration menu - View commit details
-
Copy full SHA for 02a7a84 - Browse repository at this point
Copy the full SHA 02a7a84View commit details -
An interface name comes from a scope in a valid IPv6 address. There'll always be at least three characters (::%) in front of the scope, so taking the length of an interface name which stripping these three leading characters away and adds a single null terminator will never overflow an integer.
Configuration menu - View commit details
-
Copy full SHA for c352e01 - Browse repository at this point
Copy the full SHA c352e01View commit details
Commits on Jul 28, 2024
-
Replaced usage of if_nametoindex
This eliminates a number of changes required to transcode from UTF8 and Unicode to ANSI. Instead of using if_nametoindex on Windows, this now uses ConvertInterfaceNameToLuidW & ConvertInterfaceLuidToIndex.
Configuration menu - View commit details
-
Copy full SHA for 2da63cb - Browse repository at this point
Copy the full SHA 2da63cbView commit details
Commits on Jul 30, 2024
-
When running in a container, Windows does not have a static loopback interface name. Moved tests of InterfaceInfoPal to the PalTests project, rather than testing with hardcoded IP addresses with real scope IDs. Made the tests use real (and in Windows' case, dynamic) interface names.
Configuration menu - View commit details
-
Copy full SHA for 1ba7107 - Browse repository at this point
Copy the full SHA 1ba7107View commit details
Commits on Oct 6, 2024
-
Corrected PInvoke signatures and Unix InterfaceInfoPal
* SetLastError has the correct value in the Windows interop layer. * Preserve InterfaceNameToIndex's errno in the Unix InterfaceInfoPal.
Configuration menu - View commit details
-
Copy full SHA for 038d3a6 - Browse repository at this point
Copy the full SHA 038d3a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for b79a6f5 - Browse repository at this point
Copy the full SHA b79a6f5View commit details
Commits on Oct 19, 2024
-
* Replaced int.CreateTruncating with a JIT pattern which converts from TChar to a ushort. * Removed various TChar.CreateTruncating constants, reinstating direct character constants. * Replaced branch statements when parsing IPv4 numerics with a HexConverter lookup. * IPv4 parts stored in an array of longs to improve register usage. * Small improvement in reassembly to eliminate extra array access. * Reverted changes to Uri parsing layer, removing the translation logic between a Span and a pointer for IPv4 addresses.
Configuration menu - View commit details
-
Copy full SHA for 827e5f8 - Browse repository at this point
Copy the full SHA 827e5f8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1b5ad81 - Browse repository at this point
Copy the full SHA 1b5ad81View commit details
Commits on Oct 23, 2024
-
* Replaced ushorts with integers to remove some zero-extensions. * Replaced NativeMemory with an ArrayPool<byte>. * Removed unnecessary assignment to ch.
Configuration menu - View commit details
-
Copy full SHA for dfb68d2 - Browse repository at this point
Copy the full SHA dfb68d2View commit details