Commit 6d7ac55
authored
feat: Use IPNetwork.TryParse() for CIDR parsing (#1122)
## Motivation
The CIDR parsing logic was implemented with a custom helper that
manually split strings, parsed integers, and validated prefix lengths.
The .NET framework provides a built-in and thoroughly validated
`IPNetwork.TryParse()` API that handles all of this, eliminating the
need for custom parsing code.
## Changes
- Removed the `TryParseCidr()` wrapper method entirely
- Inlined CIDR validation directly in the loop using
`IPNetwork.TryParse()`
- Removed unused `System.Net.Sockets` import
This eliminates unnecessary indirection while maintaining identical
behavior and improving maintainability by relying on framework-tested
APIs.1 parent 80585d8 commit 6d7ac55
1 file changed
Lines changed: 1 addition & 28 deletions
Lines changed: 1 addition & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 65 | | |
0 commit comments