Skip to content

Commit dc5a0ee

Browse files
committed
quic example
1 parent 0c02d15 commit dc5a0ee

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

‎README.rst‎

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Features
7373
- Proxy client/server for TCP/UDP.
7474
- Schedule (load balance) among remote servers.
7575
- Incoming traffic auto-detect.
76-
- Tunnel/relay/backward-relay support.
76+
- Tunnel/jump/backward-jump support.
7777
- Unix domain socket support.
7878
- User/password authentication support.
7979
- Filter/block hostname by regex patterns.
@@ -116,6 +116,8 @@ Protocols
116116
+-------------------+------------+------------+------------+------------+--------------+
117117
| ssh tunnel ||||| ssh:// |
118118
+-------------------+------------+------------+------------+------------+--------------+
119+
| quic ||||| http+quic:// |
120+
+-------------------+------------+------------+------------+------------+--------------+
119121
| iptables nat ||||| redir:// |
120122
+-------------------+------------+------------+------------+------------+--------------+
121123
| pfctl nat (macos) ||||| pf:// |
@@ -366,7 +368,7 @@ URI Syntax
366368

367369
- The username, colon ':', and the password
368370

369-
URIs can be joined by "__" to indicate tunneling by relay. For example, ss://1.2.3.4:1324__http://4.5.6.7:4321 make remote connection to the first shadowsocks proxy server, and then tunnel to the second http proxy server.
371+
URIs can be joined by "__" to indicate tunneling by jump. For example, ss://1.2.3.4:1324__http://4.5.6.7:4321 make remote connection to the first shadowsocks proxy server, and then jump to the second http proxy server.
370372

371373
.. _AEAD: http://shadowsocks.org/en/spec/AEAD-Ciphers.html
372374

@@ -559,9 +561,7 @@ Examples
559561
560562
Make sure **pproxy** runs in root mode (sudo), otherwise it cannot redirect pf packet.
561563

562-
- Relay tunnel
563-
564-
Relay tunnel example:
564+
- Multiple jumps example
565565

566566
.. code:: rst
567567
@@ -659,6 +659,12 @@ Examples
659659
660660
Server connects to client_ip:8081 and waits for client proxy requests. The protocol http specified is just an example. It can be any protocol and cipher **pproxy** supports. The scheme "**in**" should exist in URI to inform **pproxy** that it is a backward proxy.
661661

662+
.. code:: rst
663+
664+
$ pproxy -l http+in://jumpserver__http://client_ip:8081
665+
666+
It is a complicated example. Server connects to client_ip:8081 by jump http://jumpserver. The backward proxy works through jumps.
667+
662668
- SSH client tunnel
663669

664670
SSH client tunnel support is enabled by installing additional library asyncssh_. After "pip3 install asyncssh", you can specify "**ssh**" as scheme to proxy via ssh client tunnel.
@@ -675,6 +681,30 @@ Examples
675681
676682
SSH connection known_hosts feature is disabled by default.
677683

684+
- SSH jump
685+
686+
SSH jump is supported by using "__" concatenation
687+
688+
.. code:: rst
689+
690+
$ pproxy -r ssh://server1__ssh://server2__ssh://server3
691+
692+
First connection to server1 is made. Second, ssh connection to server2 is made from server1. Finally, connect to server3, and use server3 for proxying traffic.
693+
694+
- SSH remote forward
695+
696+
.. code:: rst
697+
698+
$ pproxy -l ssh://server__tunnel://0.0.0.0:1234 -r tunnel://127.0.0.1:1234
699+
700+
TCP :1234 on remote server is forwarded to 127.0.0.1:1234 on local server
701+
702+
.. code:: rst
703+
704+
$ pproxy -l ssh://server1__ssh://server2__ss://0.0.0.0:1234 -r ss://server3:1234
705+
706+
It is a complicated example. SSH server2 is jumped from SSH server1, and ss://0.0.0.0:1234 on server2 is listened. Traffic is forwarded to ss://server3:1234.
707+
678708
- Trojan protocol example
679709

680710
Normally trojan:// should be used together with ssl://. You should specify the SSL crt/key file for ssl usage. A typical trojan server would be:
@@ -685,6 +715,21 @@ Examples
685715
686716
If trojan password doesn't match, the tunnal{localhost:80} will be switched to. It looks exactly the same as a common HTTPS website.
687717

718+
- QUIC protocol example
719+
720+
QUIC is a UDP stream protocol in HTTP/3. Library **aioquic** is required if you want to proxy via QUIC.
721+
722+
.. code:: rst
723+
724+
$ pip3 install aioquic
725+
$ pproxy --ssl ssl.crt,ssl.key -l quic://:1234
726+
727+
On the client:
728+
729+
$ pproxy -r quic://server:1234
730+
731+
QUIC protocol can transfer a lot of TCP streams on one single UDP stream. If the connection number is hugh, QUIC can benefit by reducing TCP handshake time.
732+
688733
- VPN Server Example
689734

690735
You can run VPN server simply by installing pvpn (python vpn), a lightweight VPN server with pproxy tunnel feature.

‎pproxy/server.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ async def wait_open_connection(self, host, port, local_addr, family, tunnel=None
413413
reader, writer=self.patch_stream(reader, writer, host, port)
414414
returnreader, writer
415415
asyncdefstart_server(self, args, stream_handler=stream_handler, tunnel=None):
416+
iftype(self.jump) isProxyDirect:
417+
raiseException('ssh server mode unsupported')
416418
awaitself.wait_ssh_connection(tunnel=tunnel)
417419
conn=self.sshconn.result()
418420
ifisinstance(self.jump, ProxySSH):

0 commit comments

Comments
(0)