mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
fix resolution of mdns (.local) hostnames when connecting to bitcoin core
This commit is contained in:
parent
91d491f5ec
commit
487be2efb4
1 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -115,6 +117,17 @@ public class Bwt {
|
||||||
|
|
||||||
Config config = Config.get();
|
Config config = Config.get();
|
||||||
bwtConfig.bitcoindUrl = config.getCoreServer();
|
bwtConfig.bitcoindUrl = config.getCoreServer();
|
||||||
|
if(bwtConfig.bitcoindUrl != null) {
|
||||||
|
try {
|
||||||
|
HostAndPort hostAndPort = Protocol.HTTP.getServerHostAndPort(bwtConfig.bitcoindUrl);
|
||||||
|
if(hostAndPort.getHost().endsWith(".local")) {
|
||||||
|
InetAddress inetAddress = InetAddress.getByName(hostAndPort.getHost());
|
||||||
|
bwtConfig.bitcoindUrl = Protocol.HTTP.toUrlString(inetAddress.getHostAddress(), hostAndPort.getPort());
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HostAndPort torProxy = getTorProxy();
|
HostAndPort torProxy = getTorProxy();
|
||||||
if(Protocol.isOnionAddress(bwtConfig.bitcoindUrl) && torProxy != null) {
|
if(Protocol.isOnionAddress(bwtConfig.bitcoindUrl) && torProxy != null) {
|
||||||
|
|
Loading…
Reference in a new issue