@@ -311,6 +311,15 @@ a generic proxy allowing higher level application protocols to work through it.
311311By default, the ` Client ` communicates via SOCKS5 with the SOCKS server.
312312This is done because SOCKS5 is the latest version from the SOCKS protocol family
313313and generally has best support across other vendors.
314+ You can also omit the default ` socks:// ` URI scheme. Similarly, the ` socks5:// `
315+ URI scheme acts as an alias for the default ` socks:// ` URI scheme.
316+
317+ ``` php
318+ // all three forms are equivalent
319+ $client = new Client('127.0.0.1', $connector);
320+ $client = new Client('socks://127.0.0.1', $connector);
321+ $client = new Client('socks5://127.0.0.1', $connector);
322+ ```
314323
315324If want to explicitly set the protocol version to SOCKS4(a), you can use the URI
316325scheme ` socks4:// ` as part of the SOCKS URI:
@@ -544,7 +553,7 @@ You can use the `sockss://` URI scheme or use an explicit
544553``` php
545554$client = new Client('sockss://127.0.0.1:1080', new Connector($loop));
546555
547- $client = new Client('socks5s ://127.0.0.1:1080', new Connector($loop));
556+ $client = new Client('socks4s ://127.0.0.1:1080', new Connector($loop));
548557```
549558
550559See also [ example 32] ( examples ) .
@@ -587,7 +596,7 @@ You can use the `socks+unix://` URI scheme or use an explicit
587596``` php
588597$client = new Client('socks+unix:///tmp/proxy.sock', new Connector($loop));
589598
590- $client = new Client('socks5 +unix:///tmp/proxy.sock', new Connector($loop));
599+ $client = new Client('socks4 +unix:///tmp/proxy.sock', new Connector($loop));
591600```
592601
593602Similarly, you can also combine this with [ authentication] ( #authentication )
@@ -661,7 +670,8 @@ Internally, the `Server` uses ReactPHP's normal
661670[ ` connect() ` ] ( https://github.com/reactphp/socket#connect ) method, but
662671it also passes the original client IP as the ` ?source={remote} ` parameter.
663672The ` source ` parameter contains the full remote URI, including the protocol
664- and any authentication details, for example ` socks5://user:pass@1.2.3.4:5678 ` .
673+ and any authentication details, for example ` socks://user:pass@1.2.3.4:5678 `
674+ or ` socks4://1.2.3.4:5678 ` for legacy SOCKS4(a).
665675You can use this parameter for logging purposes or to restrict connection
666676requests for certain clients by providing a custom implementation of the
667677[ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket#connectorinterface ) .
@@ -695,8 +705,9 @@ function that should return a `bool` value like this synchronous example:
695705
696706``` php
697707$server = new Clue\React\Socks\Server($loop, null, function ($user, $pass, $remote) {
698- // $remote is a full URI à la socks5://user:pass@192.168.1.1:1234
699- // or socks5s://user:pass@192.168.1.1:1234 for SOCKS over TLS
708+ // $remote is a full URI à la socks://user:pass@192.168.1.1:1234
709+ // or sockss://user:pass@192.168.1.1:1234 for SOCKS over TLS
710+ // or may be null when remote is unknown (SOCKS over Unix Domain Sockets)
700711 // useful for logging or extracting parts, such as the remote IP
701712 $ip = parse_url($remote, PHP_URL_HOST);
702713
0 commit comments