mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 17:23:16 +00:00
freebsd update for proxy detection, when running as service
This commit is contained in:
@@ -413,9 +413,9 @@ int MeshAgent_GetSystemProxy(MeshAgentHostContainer *agent, char *buffer, size_t
|
|||||||
char getProxy[] = "(function getProxies(){\
|
char getProxy[] = "(function getProxies(){\
|
||||||
var child = require('child_process').execFile('/bin/sh', ['sh']);\
|
var child = require('child_process').execFile('/bin/sh', ['sh']);\
|
||||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });\
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });\
|
||||||
child.stdin.write('cat /etc/login.conf | grep :setenv = | awk - F\":setenv=\" \\'{ if(!($1 ~ /^#/)) { print $2 } }\\' | tr \\'\\,\\' \\'\\n\\' | awk -F= \\'{ if($1==\"https_proxy\") { gsub(/\\\\c/, \":\", $2); print $2 } }\\'\\n\\exit\\n');\
|
child.stdin.write('cat /etc/login.conf | grep :setenv= | awk -F\":setenv=\" \\'{ if(!($1 ~ /^#/)) { print $2 } }\\' | tr \"\\,\" \"\\n\" | awk -F= \\'{ if($1==\"https_proxy\") { gsub(/\\\\\\\\c/, \":\", $2); print $2 } }\\'\\n\\exit\\n');\
|
||||||
child.waitExit();\
|
child.waitExit();\
|
||||||
return(child.stdout.str.trim().split('\\n')[0]);\
|
return(child.stdout.str.trim().split('\\n')[0].split('//')[1]);\
|
||||||
})();";
|
})();";
|
||||||
#else
|
#else
|
||||||
char getProxy[] = "(function getProxies(){\
|
char getProxy[] = "(function getProxies(){\
|
||||||
@@ -3376,6 +3376,10 @@ void MeshServer_ConnectEx(MeshAgentHostContainer *agent)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Using proxy: %s\n", ILibScratchPad);
|
printf("Using proxy: %s\n", ILibScratchPad);
|
||||||
|
if(agent->logUpdate != 0)
|
||||||
|
{
|
||||||
|
ILIBLOGMESSAGEX("Using proxy: %s", ILibScratchPad);
|
||||||
|
}
|
||||||
if (delimiter > 0)
|
if (delimiter > 0)
|
||||||
{
|
{
|
||||||
ILibScratchPad[delimiter] = 0;
|
ILibScratchPad[delimiter] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user