aboutsummaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Utils.hx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server/Utils.hx b/src/server/Utils.hx
index 218184d..4764751 100644
--- a/src/server/Utils.hx
+++ b/src/server/Utils.hx
@@ -1,14 +1,17 @@
package server;
-import js.node.Http;
+import js.node.Https;
import js.node.Os;
class Utils {
public static function getGlobalIp(callback:(ip:String)->Void):Void {
- Http.get("http://myexternalip.com/raw", r -> {
+ // untyped to skip second null argument for node < v10
+ Https.get(untyped "https://myexternalip.com/raw", r -> {
r.setEncoding("utf8");
- r.on("data", callback);
+ final data = new StringBuf();
+ r.on("data", chunk -> data.add(chunk));
+ r.on("end", _ -> callback(data.toString()));
}).on("error", e -> {
trace("Warning: connection error, server is local.");
callback("127.0.0.1");
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage