From c11c99cc5439183843a98a63f4f318784a320e0e Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Wed, 27 Apr 2022 15:54:54 -0400 Subject: [PATCH] Test sia docker container IP --- packages/health-check/src/checks/critical.js | 1 - packages/health-check/src/utils.js | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/health-check/src/checks/critical.js b/packages/health-check/src/checks/critical.js index 671df9c9..77f6554b 100644 --- a/packages/health-check/src/checks/critical.js +++ b/packages/health-check/src/checks/critical.js @@ -1,6 +1,5 @@ const crypto = require("crypto"); const got = require("got"); -const FormData = require("form-data"); const { isEqual } = require("lodash"); const { calculateElapsedTime, diff --git a/packages/health-check/src/utils.js b/packages/health-check/src/utils.js index d0020205..20d372e1 100644 --- a/packages/health-check/src/utils.js +++ b/packages/health-check/src/utils.js @@ -1,3 +1,4 @@ +const FormData = require("form-data"); const ipCheckService = "whatismyip.akamai.com"; const ipRegex = new RegExp( `^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$` @@ -17,6 +18,9 @@ const defaultBaseSectorRedundancy = 10; // defaultFanoutRedundancy is the default fanout redundancy defined by skyd const defaultFanoutRedundancy = 3; +// siaDockerContainerIP is the local IP of the sia docker container +const siaDockerContainerIP = "10.10.10.10"; + /** * Get the time between start and now in milliseconds */ @@ -155,8 +159,8 @@ async function sleep(seconds) { // skylinkHealthCheck checks if the skylink has reached full redundancy async function skylinkHealthCheck(skylink, numRetries = 30, authCookie, isLarge = false) { // Get the health of the skylink - const response = await got(`https://${process.env.PORTAL_DOMAIN}/skynet/health/skylink/${skylink}`, { - headers: { cookie: authCookie }, + const response = await got(`http://${siaDockerContainerIP}/skynet/health/skylink/${skylink}`, { + headers: { "user-agent": "Sia-Agent", cookie: authCookie }, }); const healthData = getResponseContent(response);