Skip to content

updating configuration of proxu address to host and port#149

Open
karunakara-reddymaram-brt wants to merge 3 commits intoLayer7-Community:feature/F154151_socks_proxyfrom
karunakara-reddymaram-brt:F154151/US1076701_update_config
Open

updating configuration of proxu address to host and port#149
karunakara-reddymaram-brt wants to merge 3 commits intoLayer7-Community:feature/F154151_socks_proxyfrom
karunakara-reddymaram-brt:F154151/US1076701_update_config

Conversation

@karunakara-reddymaram-brt
Copy link

@karunakara-reddymaram-brt karunakara-reddymaram-brt commented Mar 16, 2026

Updated the configuration for Proxy : as follows
"proxies": {
"default": {
"agentType": "http",
"host": "http://localhost",
"port":3128,
"credential": "proxyCredentials",
"options" : {
"timeout": 30000,
"keepAlive": true,
"maxSockets": 10,
"rejectUnauthorized": false
}
}
}

@@ -1,4 +1,5 @@
// Copyright (c) 2026 Broadcom Inc. and its subsidiaries. All Rights Reserved.
const utils = require("./graphman-utils");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import; remove it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

if(input.agentType === "socks") {
return createSocksProxyAgent(input, context);
} else {
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is disturbed. revert this change.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

try {
const { SocksProxyAgent } = require("socks-proxy-agent");
agent = new SocksProxyAgent(proxyConfig.url || new URL(input.address), proxyConfig);
agent = new SocksProxyAgent(proxyConfig.url || new URL(input.host + ":" + input.port), proxyConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this line to:
agent = new SocksProxyAgent(proxyConfig.url, proxyConfig);

And, make sure that the createProxyConfig method populates the proxyConfig_.url_ always.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to createProxyConfig

if (isHttps) {
const { HttpsProxyAgent } = require("https-proxy-agent")
agent = new HttpsProxyAgent(input.address, proxyConfig);
agent = new HttpsProxyAgent(completeUrl, proxyConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like above, with the assumption that the createProxyConfig method populates the url.

agent = new HttpsProxyAgent(proxyConfig.url, proxyConfig);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

return agent;
}

function createProxyConfig(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's populate url field here.

return agent;
}

function createProxyConfig(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And, you require few supporting changes to:

  • graphman.configuration
  • graphman.sh

"default": {
"agentType": "http",
"address": "http://localhost:3128",
"host": "http://localhost",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of the host seems incorrect. It cannot be in URL form. Expected default value is: localhost

Comment on lines -77 to 90
if (cred) {
if (obj.agentType === "socks") {
const url = new URL(obj.address);
if (obj.agentType === "socks") {
const url = new URL(obj.host);
if (cred) {
url.username = cred.username;
url.password = cred.password;

proxy.url = url;
} else {
}
url.port = obj.port;
proxy.url = url;
} else {
if (cred) {
auth = `Basic ${Buffer.from(`${cred.username}:${cred.password}`).toString('base64')}`;
}
proxy.url = obj.host + ":" + obj.port;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify this.

const proxy = {};
const url = new URL(`${obj.agentType}://${obj.host}:${obj.port}`);

if (auth) {
    url.username = cred.username;
    url.password = cred.password;
}

Object.keys(obj.options).forEach(key => {
    proxy[key] = obj.options[key];
});

proxy.url = url;
return proxy;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants