@@ -227,7 +227,7 @@ static bool parse_proxy_url(const char* url, ProxyType* type, char* host, uint16
227227 username [0 ] = '\0' ;
228228 password [0 ] = '\0' ;
229229
230- // Parse type://
230+ // parse type://
231231 char * scheme_end = strstr (buffer , "://" );
232232 if (scheme_end == NULL )
233233 {
@@ -254,7 +254,7 @@ static bool parse_proxy_url(const char* url, ProxyType* type, char* host, uint16
254254 return false;
255255 }
256256
257- // Parse host:port[:username:password ]
257+ // parse host:port[:user:pass ]
258258 char * parts [4 ];
259259 int num_parts = 0 ;
260260 char * token = strtok (rest , ":" );
@@ -298,7 +298,7 @@ static bool is_root(void)
298298
299299int main (int argc , char * argv [])
300300{
301- // Check for cleanup flag first - ignores all other args
301+ // check cleanup flag
302302 for (int i = 1 ; i < argc ; i ++ )
303303 {
304304 if (strcmp (argv [i ], "--cleanup" ) == 0 )
@@ -315,7 +315,7 @@ int main(int argc, char *argv[])
315315 int num_rules = 0 ;
316316 bool dns_via_proxy = true;
317317
318- // Parse arguments
318+ // parse args
319319 for (int i = 1 ; i < argc ; i ++ )
320320 {
321321 if (strcmp (argv [i ], "--help" ) == 0 || strcmp (argv [i ], "-h" ) == 0 )
@@ -371,15 +371,15 @@ int main(int argc, char *argv[])
371371
372372 show_banner ();
373373
374- // Check root privileges
374+ // need root
375375 if (!is_root ())
376376 {
377377 printf ("\033[31m\nERROR: ProxyBridge requires root privileges!\033[0m\n" );
378378 printf ("Please run this application with sudo or as root.\n\n" );
379379 return 1 ;
380380 }
381381
382- // Parse proxy configuration
382+ // parse proxy config
383383 ProxyType proxy_type ;
384384 char proxy_host [256 ];
385385 uint16_t proxy_port ;
@@ -389,11 +389,8 @@ int main(int argc, char *argv[])
389389 if (!parse_proxy_url (proxy_url , & proxy_type , proxy_host , & proxy_port , proxy_username , proxy_password ))
390390 return 1 ;
391391
392- // Setup callbacks based on verbose level - only enable what we need
393- // Verbose 0: No callbacks, no logging (most efficient)
394- // Verbose 1: Only log messages
395- // Verbose 2: Only connection events
396- // Verbose 3: Both logs and connections
392+ // setup callbacks based on verbose
393+ // 0=nothing 1=logs 2=connections 3=both
397394
398395 if (verbose_level == 1 || verbose_level == 3 )
399396 ProxyBridge_SetLogCallback (log_callback );
@@ -405,10 +402,10 @@ int main(int argc, char *argv[])
405402 else
406403 ProxyBridge_SetConnectionCallback (NULL ); // Explicitly disable
407404
408- // Enable traffic logging in C library only when needed (prevents unnecessary processing)
405+ // turn on traffic logging when needed
409406 ProxyBridge_SetTrafficLoggingEnabled (verbose_level > 0 );
410407
411- // Display configuration
408+ // show config
412409 printf ("Proxy: %s://%s:%u\n" ,
413410 proxy_type == PROXY_TYPE_HTTP ? "http" : "socks5" ,
414411 proxy_host , proxy_port );
@@ -418,7 +415,7 @@ int main(int argc, char *argv[])
418415
419416 printf ("DNS via Proxy: %s\n" , dns_via_proxy ? "Enabled" : "Disabled" );
420417
421- // Configure proxy
418+ // setup proxy
422419 if (!ProxyBridge_SetProxyConfig (proxy_type , proxy_host , proxy_port ,
423420 proxy_username [0 ] ? proxy_username : "" ,
424421 proxy_password [0 ] ? proxy_password : "" ))
@@ -429,7 +426,7 @@ int main(int argc, char *argv[])
429426
430427 ProxyBridge_SetDnsViaProxy (dns_via_proxy );
431428
432- // Add rules
429+ // add rules
433430 if (num_rules > 0 )
434431 {
435432 printf ("Rules: %d\n" , num_rules );
@@ -469,7 +466,7 @@ int main(int argc, char *argv[])
469466 printf ("Use --rule to add proxy rules. See --help for examples.\n" );
470467 }
471468
472- // Start ProxyBridge
469+ // start proxybridge
473470 if (!ProxyBridge_Start ())
474471 {
475472 fprintf (stderr , "ERROR: Failed to start ProxyBridge\n" );
@@ -485,13 +482,13 @@ int main(int argc, char *argv[])
485482 signal (SIGABRT , signal_handler ); // Catch abort
486483 signal (SIGBUS , signal_handler ); // Catch bus error
487484
488- // Main loop
485+ // main loop
489486 while (keep_running )
490487 {
491488 sleep (1 );
492489 }
493490
494- // Cleanup
491+ // cleanup
495492 ProxyBridge_Stop ();
496493 printf ("ProxyBridge stopped.\n" );
497494
0 commit comments