diff --git a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java index b9683b05..0c30f50e 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -129,12 +129,19 @@ public class ConfigXml { } // Hardcode default globalAnnounceServer ip. - Element globalAnnounceServer = (Element) - options.getElementsByTagName("globalAnnounceServer").item(0); - if (globalAnnounceServer.getTextContent().equals("udp4://announce.syncthing.net:22026")) { - Log.i(TAG, "Replacing globalAnnounceServer host with ip"); - globalAnnounceServer.setTextContent("udp4://194.126.249.5:22026"); - changed = true; + NodeList globalAnnounceServer = options.getElementsByTagName("globalAnnounceServer"); + for (int i = 0; i < globalAnnounceServer.getLength(); i++) { + Element g = (Element) globalAnnounceServer.item(i); + if (g.getTextContent().equals("udp4://announce.syncthing.net:22026")) { + Log.i(TAG, "Replacing globalAnnounceServer address with ip"); + g.setTextContent("udp4://194.126.249.5:22026"); + changed = true; + } + if (g.getTextContent().equals("udp6://announce-v6.syncthing.net:22026")) { + Log.i(TAG, "Replacing IPv6 globalAnnounceServer address with ip"); + g.setTextContent("udp6://[2001:470:28:4d6::5]:22026"); + changed = true; + } } NodeList folders = mConfig.getDocumentElement().getElementsByTagName("folder");