在 Ubuntu 上手动配置 Google Chrome 的代理设置

Eli*_*der 9 google-chrome proxy ubuntu

我有一个应用程序需要更改谷歌浏览器使用的代理设置,然后使用浏览器,然后自动将代理切换回原来的状态。

我一直无法在我的 Ubuntu 系统上找到这些设置的存储位置。它肯定不在首选项文件中。关于如何完成这项任务的任何想法?

Str*_*bbl 12

您可以从命令行使用 Chromium 代理设置。手册页告诉您如何操作。所以这里是从我的 Ubuntu Natty 中 manchromium -browser的摘录:

   --proxy-server=host:port
          Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests.  This overrides any environment variables or settings picked via the options dialog.  An individual
          proxy server is specified using the format:

            [<proxy-scheme>://]<proxy-host>[:<proxy-port>]

          Where <proxy-scheme> is the protocol of the proxy server, and is one of:

            "http", "socks", "socks4", "socks5".

          If the <proxy-scheme> is omitted, it defaults to "http". Also note that "socks" is equivalent to "socks5".

          Examples:

            --proxy-server="foopy:99"
                Use the HTTP proxy "foopy:99" to load all URLs.

            --proxy-server="socks://foobar:1080"
                Use the SOCKS v5 proxy "foobar:1080" to load all URLs.

            --proxy-server="sock4://foobar:1080"
                Use the SOCKS v4 proxy "foobar:1080" to load all URLs.

            --proxy-server="socks5://foobar:66"
                Use the SOCKS v5 proxy "foobar:66" to load all URLs.

          It is also possible to specify a separate proxy server for different URL types, by prefixing the proxy server specifier with a URL specifier:

          Example:

            --proxy-server="https=proxy1:80;http=socks4://baz:1080"
                Load https://* URLs using the HTTP proxy "proxy1:80". And load http://*
                URLs using the SOCKS v4 proxy "baz:1080".
Run Code Online (Sandbox Code Playgroud)

使用命令行参数的优点是,您不必更改全局系统设置。

例如:

$ chromium-browser --proxy-server="http://127.0.0.1:8080"
Run Code Online (Sandbox Code Playgroud)

还可以查看 Justin 在此线程中的帖子,他还描述了如何将代理用于 DNS 请求。