/ examples / gsoc2023 / pt-proxy / README.md
README.md
 1  # pt-proxy
 2  
 3  This is a project that provides an interface to run the obfs4 pluggable transport
 4  in a standalone manner, ie, instead of using obfs4 to connect to the Tor network,
 5  we can use it to connect to the Internet directly.
 6  
 7  Just like Tor, pt-proxy exposes a SOCKS5 proxy that other programs can be configured
 8  to utilize, at which point their communications go through the Internet in an obfuscated
 9  manner, reach the obfs4 server that has been configured ahead of time, and then connect
10  to the final destination from there on.
11  
12  ## Usage
13  
14  First make sure you have [lyrebird](https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/lyrebird/) installed.
15  
16  Then, clone this repo and compile this project using `cargo`
17  
18  ### Server side
19  
20  To run this program in server mode (that is, the program will listen on a specified address and route connections
21  wherever they need to go), we run
22  
23  `cargo r -- <path-to-lyrebird> server <public-address-to-listen-to>`
24  
25  Eg. `cargo r -- /usr/bin/lyrebird server 0.0.0.0:5555` will use the binary at `/usr/bin/lyrebird`
26  and listen on all interfaces on port 5555 for incoming connections to route.
27  
28  If all goes well, you should see a string like this printed to the console:
29  
30  `Authentication info is: cert=pAAsEKxisM4YDO0Qn1UqoN1hv+jA/7uTp2ZfAB152loVTGQy9oaGAqTTO+GtkRqKeL0bVg;iat-mode=0`
31  
32  Copy and note down the `cert=pAAsEKxisM4YDO0Qn1UqoN1hv+jA/7uTp2ZfAB152loVTGQy9oaGAqTTO+GtkRqKeL0bVg;iat-mode=0` part.
33  
34  Without this long string, we can't authenticate to the obfs4 server and we won't be able
35  to use the server!
36  
37  ### Client side
38  
39  On the client side, we also need to run a local server, this local server
40  will be what your programs will connect to in order to be obfuscated using obfs4.
41  
42  To do this, we run
43  
44  `cargo r -- <path-to-lyrebird> client <remote-obfs4-server-ip> <remote-obfs4-server-port> <authentication-info>`
45  
46  The authentication info is the long string that we created in the previous section and has to be enclosed in quotation marks.
47  
48  Eg. an example usage of this program could be:
49  
50  `cargo r -- lyrebird client 12.34.56.78 5555 "cert=pAAsEKxisM4YDO0Qn1UqoN1hv+jA/7uTp2ZfAB152loVTGQy9oaGAqTTO+GtkRqKeL0bVg;iat-mode=0"``
51  
52  in order to connect to the server we initialized previously.
53  
54  By default, to use this proxy, route all connections through `socks5://127.0.0.1:9050`.
55  If you wish to use a different port for the local SOCKS5 server, pass an additional argument to the above command, like this:
56  
57  `cargo r -- lyrebird client <custom-socks5-proxy-port> 12.34.56.78 5555 "cert=pAAsEKxisM4YDO0Qn1UqoN1hv+jA/7uTp2ZfAB152loVTGQy9oaGAqTTO+GtkRqKeL0bVg;iat-mode=0"``