From cdb80f949fabb7bd7bb43d5001129b48af200163 Mon Sep 17 00:00:00 2001 From: towelbyte Date: Wed, 6 Nov 2024 18:37:12 +0100 Subject: [PATCH] Minima IPv6 quick and dirty POC This is a quick and dirty hack for Minima partial IPv6 support as a proof of concept, for demonstration purposes. This allows for peers IP:PORT to be defined for IPv6 addresses as well, by simple notation: e.g.: fda9:e0aa:589f::2:9001. For proper implementation we may want to only allow the unambiguous square brackets notation, e.g. [fda9:e0aa:589f::2]:9001 ? Can send messages over Maxima; Maxima contact addresses w/ IPv6. With this simple hack Maxima may not be backward compatible w/ IPv4-only connectable nodes. For that further changes would be needed. There may be additional backwards compatibility considerations to think of. --- src/org/minima/system/commands/maxima/maxima.java | 2 +- src/org/minima/system/commands/network/connect.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/minima/system/commands/maxima/maxima.java b/src/org/minima/system/commands/maxima/maxima.java index 63c44b1b2..941f73a29 100644 --- a/src/org/minima/system/commands/maxima/maxima.java +++ b/src/org/minima/system/commands/maxima/maxima.java @@ -467,7 +467,7 @@ public static Message createSendMessage(String zFullTo, String zApplication, Min //Send a message.. String fullto = zFullTo; int indexp = fullto.indexOf("@"); - int index = fullto.indexOf(":"); + int index = fullto.lastIndexOf(":"); //Get the Public Key String publickey = fullto.substring(0,indexp); diff --git a/src/org/minima/system/commands/network/connect.java b/src/org/minima/system/commands/network/connect.java index 3dc04ccc2..5282e8dfb 100644 --- a/src/org/minima/system/commands/network/connect.java +++ b/src/org/minima/system/commands/network/connect.java @@ -63,7 +63,7 @@ public JSONObject runCommand() throws Exception { public static Message createConnectMessage(String zFullHost) { //IP and PORT - int index = zFullHost.indexOf(":"); + int index = zFullHost.lastIndexOf(":"); if(index == -1) { return null; }