Commit 298f0361 authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Merge branch 'default-client-ports'.

This unifies endpoints used by the client in the different current scenarios:
standalone binary, Docker container, Android library.

Now the default HTTP proxy endpoint is `127.0.0.1:8077`, and the default
front-end endpoint is `127.0.0.1.:8078`, with both enabled by default.

The reason for `127.0.0.1` and not something less prone to clashes like
`127.7.2.1` (as we do in the injector) is that the client is expected to run
on many platforms (while we can assume GNU/Linux for the injector), and not
all of them support binding to addresses in `127.0.0.0/8` other than
`127.0.0.1` (e.g. macOS and other BSD-based systems).  Thus it becomes more
reasonable to choose a less crowded port (8077 and the following one in this
case).

Documentation and other references in code and other files have been updated
as well.
parents 6f38459f 53eb6eed
......@@ -159,14 +159,14 @@ For instance, if you want to run a Ouinet client (with its default
configuration) in Vagrant and use it as a proxy in a browser on your computer,
you may uncomment the following line in `Vagrantfile`:
#vm.vm.network "forwarded_port", guest: 8080, host: 8081, guest_ip: "127.0.0.1"
#vm.vm.network "forwarded_port", guest: 8077, host: 8077, guest_ip: "127.0.0.1"
And restart the environment:
$ vagrant halt
$ vagrant up
Then you can configure your browser to use `localhost` port 8081 to contact
Then you can configure your browser to use `localhost` port 8077 to contact
the HTTP proxy.
## Docker development environment
......@@ -297,7 +297,7 @@ important parameters, so you may want to stop it (see above) and use the
After you have set up your client's configuration, you can **restart it**.
The client's HTTP proxy endpoint should be available to the host at
`127.0.0.1` port 8077.
`localhost` port 8077.
If you get a "connection refused" error when using the client's proxy, your
Docker setup may not support host networking. To enable port forwarding,
......@@ -448,7 +448,7 @@ point it to the repository created above:
$ <BUIDL DIR>/client --repo /path/to/client-repo
The client opens a web proxy on local port 8080 by default (see option
The client opens a web proxy on local port 8077 by default (see option
`listen-on-tcp` in its configuration file). When you access the web using
this proxy (see the following section), your requests will go through your
local Ouinet client, which will attempt several mechanisms supported by Ouinet
......@@ -462,15 +462,15 @@ Ctrl+C.
Once your local Ouinet client is running (see above), if you have Firefox
installed, you can create a new profile (stored under the `ff-profile`
directory in the example below) which uses the Ouinet client as an HTTP proxy
(listening on `localhost:8080` here) by executing the following commands on
(listening on `localhost:8077` here) by executing the following commands on
another shell:
mkdir -p ff-profile
env http_proxy='http://localhost:8080/' firefox --no-remote --profile ff-profile
env http_proxy='http://localhost:8077/' firefox --no-remote --profile ff-profile
Otherwise you may manually [modify your browser's settings][Firefox proxy] to:
- Make the client (listening on port `localhost:8080` here) its HTTP proxy
- Make the client (listening on port `localhost:8077` here) its HTTP proxy
- Make sure that `localhost` is not listed in the *No Proxy for* field
- Check *Use this proxy for all protocols* (mostly for HTTPS)
......
......@@ -87,8 +87,8 @@ Vagrant.configure("2") do |config|
vm.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["ro", "noac"]
vm.vm.synced_folder ".", "/vagrant-rw", type: "nfs", mount_options: ["rw", "noac"]
# Uncomment this line to forward port 8081 on the host machine to port 8080 in the VM, so that you can access the VM ouinet-client from your local browser.
#vm.vm.network "forwarded_port", guest: 8080, host: 8081, guest_ip: "127.0.0.1"
# Uncomment this line to forward port 8077 on the host machine to port 8077 in the VM, so that you can access the VM ouinet-client from your local browser.
#vm.vm.network "forwarded_port", guest: 8077, host: 8077, guest_ip: "127.0.0.1"
vm.ssh.forward_x11 = true
......
......@@ -22,11 +22,11 @@ public class Ouinet {
System.loadLibrary("client");
System.loadLibrary("native-lib");
System.setProperty("http.proxyHost", "127.0.0.137");
System.setProperty("http.proxyPort", "8080");
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "8077");
System.setProperty("https.proxyHost", "127.0.0.137");
System.setProperty("https.proxyPort", "8080");
System.setProperty("https.proxyHost", "127.0.0.1");
System.setProperty("https.proxyPort", "8077");
}
private static final String TAG = "OuinetJava";
......@@ -58,8 +58,11 @@ public class Ouinet {
List<String> args = new ArrayList<>();
args.add("ouinet-client"); // App name
args.add("--repo=" + config.getOuinetDirectory());
args.add("--listen-on-tcp=127.0.0.137:8080");
args.add("--front-end-ep=127.0.0.137:8081");
// If default client endpoints clash with other ports,
// uncomment these and change `http(s).proxyPort` above to match.
//args.add("--listen-on-tcp=127.0.0.1:8177");
//args.add("--front-end-ep=127.0.0.1:8178");
// Useful for debugging
//args.add("--disable-origin-access");
......
......@@ -45,11 +45,13 @@ services:
#network_mode: bridge
#ports:
# - "127.0.0.1:8077:8077" # client HTTP proxy
# - "127.0.0.1:8078:8078" # client front-end
#
# Also run the command below in the shell container
# to modify ``listen-on-*`` options to use ``0.0.0.0``:
# Then edit `client/ouinet-client.conf` in the shell container
# so that the following options appear:
#
# sed -E 's/(^listen-on-\S+\s*=\s*)127.0.0.1(:.*)/\10.0.0.0\2/' */ouinet-*.conf
# listen-on-tcp = 0.0.0.0:8077
# front-end-ep = 0.0.0.0:8078
#
command: ["${OUINET_ROLE:-client}"]
# The service will be restarted (also on reboot)
......
# Run ``client --help`` for help on available options.
open-file-limit = 4096
listen-on-tcp = 127.0.0.1:8080
#!/bin/bash
PROFILE=$(mktemp -d)
http_proxy="http://localhost:8080/" firefox --no-remote --profile "${PROFILE}"
http_proxy="http://localhost:8077/" firefox --no-remote --profile "${PROFILE}"
rm -rf ${PROFILE}
......@@ -107,9 +107,11 @@ public:
("debug", "Enable debugging messages")
// Client options
("listen-on-tcp", po::value<string>(), "IP:PORT endpoint on which we'll listen")
("listen-on-tcp"
, po::value<string>()->default_value("127.0.0.1:8077")
, "HTTP proxy endpoint (in <IP>:<PORT> format)")
("front-end-ep"
, po::value<string>()->default_value("127.0.0.137:8081")
, po::value<string>()->default_value("127.0.0.1:8078")
, "Front-end's endpoint (in <IP>:<PORT> format)")
("tls-ca-cert-store-path", po::value<string>(&_tls_ca_cert_store_path)
, "Path to the CA certificate store file")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment