Skip to content

Commit

Permalink
enforce ipv4
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Dec 26, 2024
1 parent 0a89097 commit 735b6a8
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
warpscript.maxops: '10000000'
ENABLE_SENSISION: 't'
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- 8082:8082
- 9718:9718
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand All @@ -201,7 +201,7 @@ jobs:
- 8700:8700
- 8800:8800
options: >-
--health-cmd "curl http://localhost:8500/_/healthcheck"
--health-cmd "curl http://127.0.0.1:8500/_/healthcheck"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
- 8082:8082
- 9718:9718
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand All @@ -322,7 +322,7 @@ jobs:
- 8700:8700
- 8800:8800
options: >-
--health-cmd "curl http://localhost:8500/_/healthcheck"
--health-cmd "curl http://127.0.0.1:8500/_/healthcheck"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down
2 changes: 1 addition & 1 deletion examples/javascript-V4Auth-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const requestBody = JSON.stringify({
timeRange: [startTime, endTime],
});
const header = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand Down
2 changes: 1 addition & 1 deletion examples/python-V4Auth-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

method = 'POST'
service = 's3'
host = 'localhost:8100'
host = '127.0.0.1:8100'
region = 'us-east-1'
canonical_uri = '/buckets'
canonical_querystring = 'Action=ListMetrics&Version=20160815'
Expand Down
2 changes: 1 addition & 1 deletion libV2/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Uploader extends Transform {

class UtapiClient {
constructor(config) {
this._host = (config && config.host) || 'localhost';
this._host = (config && config.host) || '127.0.0.1';
this._port = (config && config.port) || '8100';
this._tls = (config && config.tls) || {};
this._transport = (config && config.tls) ? 'https' : 'http';
Expand Down
4 changes: 2 additions & 2 deletions libV2/config/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"repairSchedule": "0 */5 * * * *",
"reindexSchedule": "0 0 0 * * Sun",
"diskUsageSchedule": "0 */15 * * * *",
"bucketd": [ "localhost:9000" ],
"bucketd": [ "127.0.0.1:9000" ],
"reindex": {
"enabled": true,
"schedule": "0 0 0 * * 6"
Expand All @@ -57,7 +57,7 @@
},
"metrics" : {
"enabled": false,
"host": "localhost",
"host": "127.0.0.1",
"ingestPort": 10902,
"checkpointPort": 10903,
"snapshotPort": 10904,
Expand Down
2 changes: 1 addition & 1 deletion libV2/models/RequestContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const RequestContextModel = buildModel('RequestContext', contextSchema);

class RequestContext extends RequestContextModel {
constructor(request) {
const host = request.headers.host || 'localhost';
const host = request.headers.host || '127.0.0.1';
const protocol = RequestContext._determineProtocol(request);
const encrypted = protocol === 'https';
const url = `${protocol}://${host}${request.url}`;
Expand Down
2 changes: 1 addition & 1 deletion libV2/tasks/BaseTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BaseTask extends Process {
this._defaultSchedule = Now;
this._defaultLag = 0;
this._enableMetrics = options.enableMetrics || false;
this._metricsHost = options.metricsHost || 'localhost';
this._metricsHost = options.metricsHost || '127.0.0.1';
this._metricsPort = options.metricsPort || 9001;
this._metricsHandlers = null;
this._probeServer = null;
Expand Down
2 changes: 1 addition & 1 deletion libV2/tasks/ManualAdjust.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ManualAdjust extends BaseTask {
// Don't include default flags
await super._setup(false);
this._program
.option('-h, --host <host>', 'Utapi server host', 'localhost')
.option('-h, --host <host>', 'Utapi server host', '127.0.0.1')
.option('-p, --port <port>', 'Utapi server port', '8100', parseInt)
.option('-b, --bucket <buckets...>', 'target these buckets', collectArgs, [])
.option('-a, --account <accounts...>', 'target these accounts', collectArgs, [])
Expand Down
2 changes: 1 addition & 1 deletion libV2/warp10.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Warp10Client {
const proto = (config && config.tls) ? 'https' : 'http';
this._requestTimeout = (config && config.requestTimeout) || 30000;
this._connectTimeout = (config && config.connectTimeout) || 30000;
const host = (config && config.host) || 'localhost';
const host = (config && config.host) || '127.0.0.1';
const port = (config && config.port) || 4802;
this._client = new Warp10().endpoint(`${proto}://${host}:${port}`, this._requestTimeout, this._connectTimeout);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/server/testInvalidRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Invalid requests', () => {
{
describe: 'should forbid a GET request ',
header: {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'GET',
service: 's3',
Expand All @@ -30,7 +30,7 @@ describe('Invalid requests', () => {
{
describe: 'should forbid a GET request ',
header: {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'GET',
service: 's3',
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/v2/server/testHealthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const needle = require('needle');

describe('Test healthcheck handler', () => {
it('should return true', async () => {
const res = await needle('get', 'http://localhost:8100/_/healthcheck');
const res = await needle('get', 'http://127.0.0.1:8100/_/healthcheck');
assert.strictEqual(res.statusCode, 200);
assert.strictEqual(res.statusMessage, 'OK');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/v2/server/testIngestMetric.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { generateFakeEvents } = require('../../../utils/v2Data');
function utapiRequest(events) {
return needle(
'post',
'http://localhost:8100/v2/ingest',
'http://127.0.0.1:8100/v2/ingest',
events,
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/v2/server/testListMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function listMetrics(level, resources, start, end, credentials) {
}

const headers = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand All @@ -61,7 +61,7 @@ async function listMetrics(level, resources, start, end, credentials) {

return needle(
'post',
`http://localhost:8100/${level}?Action=ListMetrics`,
`http://127.0.0.1:8100/${level}?Action=ListMetrics`,

body,
{
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/v2/server/testPrometheusMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const testMetrics = async pair => {

describe('Test Prometheus Metrics', () => {
const nameUrlPairs = [
['utapi nodejs service exporter', 'http://localhost:8100/_/metrics'],
['sensision exporter', 'http://localhost:9718/metrics'],
['redis exporter', 'http://localhost:9121/metrics'],
['utapi nodejs service exporter', 'http://127.0.0.1:8100/_/metrics'],
['sensision exporter', 'http://127.0.0.1:9718/metrics'],
['redis exporter', 'http://127.0.0.1:9121/metrics'],
];
nameUrlPairs.forEach(pair => testMetrics(pair));
});
2 changes: 1 addition & 1 deletion tests/functional/v2/task/testBaseTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Test BaseTask metrics', () => {
it('should start a metrics server on the provided port', async () => {
const res = await needle(
'get',
`http://localhost:${METRICS_SERVER_PORT}${DEFAULT_METRICS_ROUTE}`,
`http://127.0.0.1:${METRICS_SERVER_PORT}${DEFAULT_METRICS_ROUTE}`,
);
const lines = res.body.split('\n');
const first = lines[0];
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/testUtapiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const metricTypes = {
accountId: 'foo-account',
userId: 'foo-user',
};
const redisLocal = { host: 'localhost', port: 6379 };
const redisLocal = { host: '127.0.0.1', port: 6379 };
const config = {
redis: redisLocal,
localCache: redisLocal,
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function buildMockResponse({ start, end, val }) {

function makeUtapiClientRequest({ timeRange, resource }, cb) {
const header = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand All @@ -125,7 +125,7 @@ function makeUtapiClientRequest({ timeRange, resource }, cb) {

function makeUtapiGenericClientRequest(reqHeader, reqBody, cb) {
const header = Object.assign({
host: 'localhost',
host: '127.0.0.1',
port: 8100,
service: 's3',
}, reqHeader);
Expand Down Expand Up @@ -173,7 +173,7 @@ function _buildRequestBody(resource) {
function listMetrics(resource, cb) {
const requestBody = _buildRequestBody(resource);
const header = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/vaultclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class VaultClient {
}

static getIAMClient(credentials) {
const endpoint = process.env.VAULT_ENDPOINT || 'http://localhost:8600';
const endpoint = process.env.VAULT_ENDPOINT || 'http://127.0.0.1:8600';
const info = {
endpoint,
sslEnabled: false,
Expand Down

0 comments on commit 735b6a8

Please sign in to comment.