@@ -15,6 +15,7 @@ import {fileURLToPath} from 'url';
1515import { HttpsProxyAgent } from 'https-proxy-agent' ;
1616import { exec } from 'child_process' ;
1717import util from 'util' ;
18+ import { ENV } from './env.js' ; // Import ENV utility
1819
1920const execAsync = util . promisify ( exec ) ;
2021const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
@@ -26,6 +27,13 @@ const configPath = path.resolve(__dirname, '../config/player.json');
2627
2728// Initialize Resolver Lazy
2829function getResolver ( ) {
30+ // Check if DOH is enabled via ENV (default: 1/true)
31+ const enableDoh = ENV . get ( 'enable_doh' , '1' ) === '1' || ENV . get ( 'enable_doh' ) === 'true' ;
32+ if ( ! enableDoh ) {
33+ // console.log('[DOH] DOH is disabled via ENV.');
34+ return null ;
35+ }
36+
2937 if ( resolver ) return resolver ;
3038 try {
3139 // Load config if not loaded
@@ -65,6 +73,13 @@ let checkPromise = null;
6573const PROXY_CACHE_TTL = 60000 ; // 60 seconds cache
6674
6775export function getSystemProxy ( ) {
76+ // Check if system proxy detection is enabled via ENV (default: 1/true)
77+ const enableProxy = ENV . get ( 'enable_system_proxy' , '1' ) === '1' || ENV . get ( 'enable_system_proxy' ) === 'true' ;
78+ if ( ! enableProxy ) {
79+ // console.log('[DOH] System proxy detection is disabled via ENV.');
80+ return Promise . resolve ( null ) ;
81+ }
82+
6883 const now = Date . now ( ) ;
6984 // 1. If cache is valid (checked within 60s), return immediately
7085 if ( lastCheckTime > 0 && ( now - lastCheckTime < PROXY_CACHE_TTL ) ) {
0 commit comments