Test sia docker container IP

This commit is contained in:
Matthew Sevey 2022-04-27 15:54:54 -04:00
parent 67c3fd1cf3
commit c11c99cc54
No known key found for this signature in database
GPG Key ID: 9ADDD344F13057F6
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,5 @@
const crypto = require("crypto"); const crypto = require("crypto");
const got = require("got"); const got = require("got");
const FormData = require("form-data");
const { isEqual } = require("lodash"); const { isEqual } = require("lodash");
const { const {
calculateElapsedTime, calculateElapsedTime,

View File

@ -1,3 +1,4 @@
const FormData = require("form-data");
const ipCheckService = "whatismyip.akamai.com"; const ipCheckService = "whatismyip.akamai.com";
const ipRegex = new RegExp( 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}$` `^(?: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 // defaultFanoutRedundancy is the default fanout redundancy defined by skyd
const defaultFanoutRedundancy = 3; 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 * 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 // skylinkHealthCheck checks if the skylink has reached full redundancy
async function skylinkHealthCheck(skylink, numRetries = 30, authCookie, isLarge = false) { async function skylinkHealthCheck(skylink, numRetries = 30, authCookie, isLarge = false) {
// Get the health of the skylink // Get the health of the skylink
const response = await got(`https://${process.env.PORTAL_DOMAIN}/skynet/health/skylink/${skylink}`, { const response = await got(`http://${siaDockerContainerIP}/skynet/health/skylink/${skylink}`, {
headers: { cookie: authCookie }, headers: { "user-agent": "Sia-Agent", cookie: authCookie },
}); });
const healthData = getResponseContent(response); const healthData = getResponseContent(response);