CreateProxyByPortConfigs

Forwards multiple proxies based on a list of ports. Proxy information is taken from existing configured ports; any port without configuration is skipped.

int CreateProxyByPortConfigs(char* requestId, char* plan, uint32_t* ports, int n, uint32_t** outPtr, int* outLen)

Parameters

  • requestId (char*): Correlation ID used to receive success/failure status via events.

  • plan (char*): Plan ID (default “1”).

  • ports (uint32_t*): Input array of ports to forward.

  • n (int): Number of elements in ports.

  • outPtr (uint32_t**): Output pointer that will receive a heap-allocated array of successfully forwarded ports. Must be freed with FreeBuf().

  • outLen (int*): Output count of elements written to outPtr.

Return Value

  • int: 0 on success; non-zero on error.

NOTE

  • Action type defaults to "manual" internally; there is no actionType parameter for this function.

  • When the function returns 0 but outLen is 0, no ports were forwarded (all skipped or failed).

  • Caller must FreeBuf(outPtr) when outPtr is non-NULL.

Example

// example

uint32_t inPorts[]={60001,60002,60003};
uint32_t* out=NULL; int m=0;
if (CreateProxyByPortConfigs("px","pro",inPorts,3,&out,&m)==0 && out){
  for(int i=0;i<m;i++) printf("OK %u\n", out[i]);
  FreeBuf(out);
}

Last updated

Was this helpful?