11# clue/reactphp-socks [ ![ Build Status] ( https://travis-ci.org/clue/reactphp-socks.svg?branch=master )] ( https://travis-ci.org/clue/reactphp-socks )
22
3- Async SOCKS proxy connector client and server implementation, use any TCP/IP-based
3+ Async SOCKS proxy connector client and server implementation, tunnel any TCP/IP-based
44protocol through a SOCKS5 or SOCKS4(a) proxy server, built on top of
55[ ReactPHP] ( https://reactphp.org ) .
66
7- The SOCKS protocol family can be used to easily tunnel TCP connections independent
8- of the actual application level protocol, such as HTTP, SMTP, IMAP, Telnet etc.
7+ The SOCKS proxy protocol family (SOCKS5, SOCKS4 and SOCKS4a) is commonly used to
8+ tunnel HTTP(S) traffic through an intermediary ("proxy"), to conceal the origin
9+ address (anonymity) or to circumvent address blocking (geoblocking). While many
10+ (public) SOCKS proxy servers often limit this to HTTP(S) port ` 80 ` and ` 443 `
11+ only, this can technically be used to tunnel any TCP/IP-based protocol (HTTP,
12+ SMTP, IMAP etc.).
13+ This library provides a simple API to create these tunneled connections for you.
14+ Because it implements ReactPHP's standard
15+ [ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket#connectorinterface ) ,
16+ it can simply be used in place of a normal connector.
17+ This makes it fairly simple to add SOCKS proxy support to pretty much any
18+ existing higher-level protocol implementation.
19+ Besides the client side, it also provides a simple SOCKS server implementation
20+ which allows you to build your own SOCKS proxy servers with custom business logic.
21+
22+ * ** Async execution of connections** -
23+ Send any number of SOCKS requests in parallel and process their
24+ responses as soon as results come in.
25+ The Promise-based design provides a * sane* interface to working with out of
26+ bound responses and possible connection errors.
27+ * ** Standard interfaces** -
28+ Allows easy integration with existing higher-level components by implementing
29+ ReactPHP's standard
30+ [ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket#connectorinterface ) .
31+ * ** Lightweight, SOLID design** -
32+ Provides a thin abstraction that is [ * just good enough* ] ( https://en.wikipedia.org/wiki/Principle_of_good_enough )
33+ and does not get in your way.
34+ Builds on top of well-tested components and well-established concepts instead of reinventing the wheel.
35+ * ** Good test coverage** -
36+ Comes with an automated tests suite and is regularly tested against actual proxy servers in the wild.
937
1038** Table of contents**
1139
@@ -255,10 +283,10 @@ a generic proxy allowing higher level application protocols to work through it.
255283 </tr >
256284 <tr >
257285 <th>Protocol specification</th>
258- <td><a href="http ://tools.ietf.org/html/rfc1928">RFC 1928</a></td>
286+ <td><a href="https ://tools.ietf.org/html/rfc1928">RFC 1928</a></td>
259287 <td>
260- <a href="http ://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol">SOCKS4.protocol</a> /
261- <a href="http ://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4A.protocol">SOCKS4A.protocol</a>
288+ <a href="https ://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol">SOCKS4.protocol</a> /
289+ <a href="https ://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4A.protocol">SOCKS4A.protocol</a>
262290 </td>
263291 </tr >
264292 <tr >
@@ -278,7 +306,7 @@ a generic proxy allowing higher level application protocols to work through it.
278306 </tr >
279307 <tr >
280308 <th><a href="#authentication">Username/Password authentication</a></th>
281- <td>✓ (as per <a href="http ://tools.ietf.org/html/rfc1929">RFC 1929</a>)</td>
309+ <td>✓ (as per <a href="https ://tools.ietf.org/html/rfc1929">RFC 1929</a>)</td>
282310 <td>✗</td>
283311 </tr >
284312 <tr >
@@ -385,7 +413,7 @@ as usual.
385413#### Authentication
386414
387415This library supports username/password authentication for SOCKS5 servers as
388- defined in [ RFC 1929] ( http ://tools.ietf.org/html/rfc1929) .
416+ defined in [ RFC 1929] ( https ://tools.ietf.org/html/rfc1929) .
389417
390418On the client side, simply pass your username and password to use for
391419authentication (see below).
@@ -927,32 +955,40 @@ $client = new Client('socks+unix:///tmp/proxy.sock', $connector);
927955
928956### Using the Tor (anonymity network) to tunnel SOCKS connections
929957
930- The [ Tor anonymity network] ( http ://www.torproject.org) client software is designed
958+ The [ Tor anonymity network] ( https ://www.torproject.org) client software is designed
931959to encrypt your traffic and route it over a network of several nodes to conceal its origin.
932960It presents a SOCKS5 and SOCKS4(a) interface on TCP port 9050 by default
933- which allows you to tunnel any traffic through the anonymity network.
934- In most scenarios you probably don't want your client to resolve the target hostnames,
935- because you would leak DNS information to anybody observing your local traffic.
936- Also, Tor provides hidden services through an ` .onion ` pseudo top-level domain
937- which have to be resolved by Tor.
961+ which allows you to tunnel any traffic through the anonymity network:
938962
939- ``` PHP
963+ ``` php
940964$client = new Client('127.0.0.1:9050', $connector);
941965```
942966
967+ In most common scenarios you probably want to stick to default
968+ [ remote DNS resolution] ( #dns-resolution ) and don't want your client to resolve the target hostnames,
969+ because you would leak DNS information to anybody observing your local traffic.
970+ Also, Tor provides hidden services through an ` .onion ` pseudo top-level domain
971+ which have to be resolved by Tor.
972+
943973## Install
944974
945975The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
946976[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
947977
978+ This project follows [ SemVer] ( https://semver.org/ ) .
948979This will install the latest supported version:
949980
950981``` bash
951- $ composer require clue/socks-react:^0.8.7
982+ $ composer require clue/socks-react:^1.0
952983```
953984
954985See also the [ CHANGELOG] ( CHANGELOG.md ) for details about version upgrades.
955986
987+ This project aims to run on any platform and thus does not require any PHP
988+ extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
989+ HHVM.
990+ It's * highly recommended to use PHP 7+* for this project.
991+
956992## Tests
957993
958994To run the test suite, you first need to clone this repo and then install all
@@ -977,7 +1013,10 @@ $ php vendor/bin/phpunit --exclude-group internet
9771013
9781014## License
9791015
980- MIT, see LICENSE
1016+ This project is released under the permissive [ MIT license] ( LICENSE ) .
1017+
1018+ > Did you know that I offer custom development services and issuing invoices for
1019+ sponsorships of releases and for contributions? Contact me (@clue ) for details.
9811020
9821021## More
9831022
0 commit comments