Skip to content

Commit

Permalink
Merge branch '2.x' into fix-spring-localTcc
Browse files Browse the repository at this point in the history
  • Loading branch information
xingfudeshi authored Jan 16, 2025
2 parents a55ee41 + dd94d71 commit b93153b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Add changes here for all PR submitted to the 2.x branch.
### bugfix:

- [[#7104](https://github.com/apache/incubator-seata/pull/7104)] fix impl of supportsSourceType is not defined
- [[#7112](https://github.com/apache/incubator-seata/pull/7112)] bugfix: remove the condition that IPv6 must start with fe80


### optimize:
Expand Down Expand Up @@ -45,6 +46,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [PeppaO](https://github.com/PeppaO)
- [funky-eyes](https://github.com/funky-eyes)
- [psxjoy](https://github.com/psxjoy)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
2 changes: 2 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### bugfix:

- [[#7104](https://github.com/apache/incubator-seata/pull/7104)] 修复SeataApplicationListener在低版本springboot未实现supportsSourceType方法的问题
- [[#7112](https://github.com/apache/incubator-seata/pull/7112)] 校验是否IPv6网络ip取消必须以fe80开始的条件

### optimize:

Expand Down Expand Up @@ -44,5 +45,6 @@
- [PeppaO](https://github.com/PeppaO)
- [funky-eyes](https://github.com/funky-eyes)
- [psxjoy](https://github.com/psxjoy)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ public class NetAddressValidatorUtil {

private static final String DOUBLE_COLON_FFFF = "::ffff:";

private static final String FE80 = "fe80:";

private static final int ZERO = 0;

private static final int SEVEN = 7;

private static final int FIVE = 5;

private static final Pattern IPV4_PATTERN = Pattern
.compile("^" + "(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)" + "(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}" + "$");

Expand Down Expand Up @@ -133,19 +129,17 @@ public static boolean isIPv6IPv4MappedAddress(final String input) {
}

/**
* Check if <code>input</code> is a link local IPv6 address starting with "fe80:" and containing
* Check if <code>input</code> is a link local IPv6 address containing
* a zone index with "%xxx". The zone index will not be checked.
*
* @param input ip-address to check
* @return true if address part of <code>input</code> is in correct IPv6 notation.
*/
public static boolean isLinkLocalIPv6WithZoneIndex(String input) {
if (input.length() > FIVE && input.substring(ZERO, FIVE).equalsIgnoreCase(FE80)) {
int lastIndex = input.lastIndexOf(PERCENT);
if (lastIndex > ZERO && lastIndex < (input.length() - 1)) {
String ipPart = input.substring(ZERO, lastIndex);
return isIPv6StdAddress(ipPart) || isIPv6HexCompressedAddress(ipPart);
}
int lastIndex = input.lastIndexOf(PERCENT);
if (lastIndex > ZERO && lastIndex < (input.length() - 1)) {
String ipPart = input.substring(ZERO, lastIndex);
return isIPv6StdAddress(ipPart) || isIPv6HexCompressedAddress(ipPart);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,10 @@ public void isIPv4Address() {
assertThat(NetAddressValidatorUtil.isIPv4Address("127.0.0.1")).isTrue();
assertThat(NetAddressValidatorUtil.isIPv4Address("999.999.999.999")).isFalse();
}

@Test
public void isLinkLocalIPv6WithZoneIndex() {
assertThat(NetAddressValidatorUtil.isLinkLocalIPv6WithZoneIndex("2409:8a5c:6730:4490:f0e8:b9ad:3b3d:e739%br0")).isTrue();
assertThat(NetAddressValidatorUtil.isLinkLocalIPv6WithZoneIndex("2409:8a5c:6730:4490:f0e8:b9ad:3b3d:e739%")).isFalse();
}
}

0 comments on commit b93153b

Please sign in to comment.