mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-01 01:32:17 +01:00
Merge pull request #7310 from alvasw/NodeAddress_Fix_broken_IPV6_parsing
NodeAddress: Fix broken IPV6 parsing
This commit is contained in:
commit
ab9385db8f
1 changed files with 13 additions and 4 deletions
|
@ -47,10 +47,19 @@ public final class NodeAddress implements PersistablePayload, NetworkPayload, Us
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeAddress(String fullAddress) {
|
public NodeAddress(String fullAddress) {
|
||||||
final String[] split = fullAddress.split(Pattern.quote(":"));
|
String[] split = fullAddress.split("]");
|
||||||
checkArgument(split.length == 2, "fullAddress must contain ':'");
|
boolean isIpV6Address = split.length == 2 && fullAddress.startsWith("[");
|
||||||
this.hostName = split[0];
|
if (isIpV6Address) {
|
||||||
this.port = Integer.parseInt(split[1]);
|
this.hostName = split[0].replace("[", "");
|
||||||
|
String portString = split[1].replace(":", "");
|
||||||
|
this.port = Integer.parseInt(portString);
|
||||||
|
} else {
|
||||||
|
split = fullAddress.split(Pattern.quote(":"));
|
||||||
|
checkArgument(split.length == 2, "fullAddress must contain ':'");
|
||||||
|
this.hostName = split[0];
|
||||||
|
|
||||||
|
this.port = Integer.parseInt(split[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue