Заметки

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

 

  • Создаем локальный прокси, например по этой инструкции: 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"
        , "slack.com"
         , "local"
      , "77.221.138.96"
      , 'xn--90adear.xn--p1ai', '79.143.31.132',
      , 'xn--p1ai', 'live.com', 'vk.com'
      , 'tochka.com'
      , '4pda.to'
      , 'miro.com'
      , 'colab.research.google.com'
      , 'videoproc.com'
      , 'savefrom.net'
      , 'speedtest.net'
      , 'anydesk.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

 

Афоризм дня:
Мыслить – значит говорить с самим собой, слышать себя самого. (518)

Leave a reply

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