Заметки

Как проксировать одни сайты и заходить напрямую на другие?

 

  • Создаем локальный прокси, например по этой инструкции: https://habr.com/ru/articles/735536/ + В NekoBox снимаем галочку  "TUN Mode". Либо берем какой либо другой и используем далее в коде.
  • ставим расширение в хром Proxy Switcher and Manager (https://chromewebstore.google.com/detail/onnfghpihccifgojkpnnncpagjcdbjod)
  • На вкладке "PAC Script" выбираем пункт "
  • добавляем такой код:
  • // List of domains to connect directly
    const directDomains = [
        "localhost", "127.0.0.1", "ru", "youtube.com",
    ];
    
    function FindProxyForURL(url, host) {
        // Check if the host is in the directDomains list or is a subdomain of any listed domains
        const isDirect = directDomains.some(domain => {
            // Check if the host is exactly the domain or a subdomain of it
            return host === domain || host.endsWith(`.${domain}`);
        });
    
        // Directly connect to the host for listed domains or their subdomains
        if (isDirect) {
            return "DIRECT";
        }
    
        // Use the specified proxy for all other traffic
        return "PROXY 127.0.0.1:2080";
    }
    
    
  • Проверяем как работает такими инструментами:
  • PROFIT!!!


Sources:

https://www.google.com/search?q=Proxy+Switcher+and+Manager

 

Афоризм дня:
Музыка – лучшее утешение для опечаленного человека. (527)

Leave a reply

Яндекс.Метрика