wy471x opened a new pull request, #6454: URL: https://github.com/apache/shenyu/pull/6454
Replace brittle SocketAddress.toString() substring parsing with proper InetSocketAddress.getHostString() and InetAddress.equals() comparison. This fixes incorrect IP extraction for IPv6 addresses and makes upstream connection matching robust across address formats. <!-- Describe your PR here; e.g. Fixes #issueNo --> <!-- Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request. --> Make sure that: - [X] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [X] You submit test cases (unit or integration tests) that back your changes. - [X] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. ## Summary of all changes: ### Source fixes TcpBootstrapServer.java — getIp() now casts to InetSocketAddress and uses getHostString() instead of brittle toString().substring(1, address.indexOf(':')). ActivityConnectionObserver.java — in() now: - Casts to InetSocketAddress instead of parsing toString() - For resolved addresses: uses InetAddress.equals() comparison (handles IPv4/IPv6 format normalization) - For unresolved addresses: falls back to host:port string comparison - Returns false for unsupported address types ### Test files added - TcpBootstrapServerTest.java — 4 tests: IPv4, IPv6, null, unsupported address type - ActivityConnectionObserverTest.java — 7 tests: IPv4 match/mismatch, IPv6 match/mismatch, unresolved IPv6, unsupported address type, empty remove list close [#6447](https://github.com/apache/shenyu/issues/6447) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
