Notes

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

 

  • Создаем локальный прокси, например по этой инструкции: 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'
      , 'maps.me'
      , 'skyeng'
      , 'google.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:2081";
    }
  • Проверяем как работает такими инструментами:
  • PROFIT!!!

 

VPN наоборот, или как подключаться к доменам нужной страны напрямую

Для доступа к российским сайтам из-за границы

  • // List of domains to use VPN
    const vpnDomains = [
        "ru",
        "xn--p1ai"
    ];
    
    function FindProxyForURL(url, host) {
        // Check if the host is in the vpnDomains list or is a subdomain of any listed domains
        const useVpn = vpnDomains.some(domain => {
            // Check if the host is exactly the domain or a subdomain of it
            return host === domain || host.endsWith(`.${domain}`);
        });
    
        // Use VPN for selected domains or their subdomains
        if (useVpn) {
            return "PROXY 127.0.0.1:2081";
        }
    
        // Directly connect to the host for all other traffic
        return "DIRECT";
    }
    


Sources:

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

 

Афоризм дня:
Мы восприимчивы к дружбе, справедливости, человечности, состраданию и разуму. Не это ли есть добродетель, друзья мои? (526)

Leave a reply

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