Download the PHP package clue/socks-server without Composer

On this page you can find all versions of the php package clue/socks-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package socks-server

Deprecation notice

This package has now been merged into clue/socks-react and only exists for BC reasons.

If you've previously used this package to build a SOCKS server, upgrading should take no longer than a few minutes. All classes have been merged as-is from the latest v0.7.0 release with no other changes, so you can simply update your code to use the updated namespace like this:

See https://github.com/clue/php-socks-react for more details.

The below documentation applies to the last release of this package. Further development will take place in the updated clue/socks-react, so you're highly recommended to upgrade as soon as possible.

Legacy clue/socks-server Build Status

Async SOCKS proxy server (SOCKS4, SOCKS4a and SOCKS5), built on top of React PHP.

The SOCKS protocol family can be used to easily tunnel TCP connections independent of the actual application level protocol, such as HTTP, SMTP, IMAP, Telnet etc.

Table of contents

Quickstart example

Once installed, you can use the following code to create a SOCKS proxy server listening for connections on localhost:1080:

See also the examples.

Usage

Server

The Server is responsible for accepting incoming communication from SOCKS clients and forwarding the requested connection to the target host. It also registers everything with the main EventLoop and an underlying TCP/IP socket server like this:

If you need custom connector settings (DNS resolution, timeouts etc.), you can explicitly pass a custom instance of the ConnectorInterface:

Protocol version

The Server supports all protocol versions (SOCKS4, SOCKS4a and SOCKS5) by default.

While SOCKS4 already had (a somewhat limited) support for SOCKS BIND requests and SOCKS5 added generic UDP support (SOCKS UDPASSOCIATE), this library focuses on the most commonly used core feature of SOCKS CONNECT. In this mode, a SOCKS server acts as a generic proxy allowing higher level application protocols to work through it.

SOCKS4 SOCKS4a SOCKS5
Protocol specification SOCKS4.protocol SOCKS4A.protocol RFC 1928
Tunnel outgoing TCP connections
Remote DNS resolving
IPv6 addresses
Username/Password authentication ✓ (as per RFC 1929)
Handshake # roundtrips 1 1 2 (3 with authentication)
Handshake traffic
+ remote DNS
17 bytes
17 bytes
+ hostname + 1
variable (+ auth + IPv6)
+ hostname - 3

Note, this is not a full SOCKS5 implementation due to missing GSSAPI authentication (but it's unlikely you're going to miss it anyway).

If want to explicitly set the protocol version, use the supported values 4, 4a or 5:

In order to reset the protocol version to its default (i.e. automatic detection), use null as protocol version.

Authentication

By default, the Server does not require any authentication from the clients. You can enable authentication support so that clients need to pass a valid username and password before forwarding any connections.

Setting authentication on the Server enforces each further connected client to use protocol version 5 (SOCKS5). If a client tries to use any other protocol version, does not send along authentication details or if authentication details can not be verified, the connection will be rejected.

Because your authentication mechanism might take some time to actually check the provided authentication credentials (like querying a remote database or webservice), the server side uses a Promise based interface. While this might seem complex at first, it actually provides a very simple way to handle simultanous connections in a non-blocking fashion and increases overall performance.

Or if you only accept static authentication details, you can use the simple array-based authentication method as a shortcut:

See also the second example.

If you do not want to use authentication anymore:

Proxy chaining

The Server is responsible for creating connections to the target host.

Sometimes it may be required to establish outgoing connections via another SOCKS server. For example, this can be useful if your target SOCKS server requires authentication, but your client does not support sending authentication information (e.g. like most webbrowser).

The Server uses any instance of the ConnectorInterface to establish outgoing connections. In order to connect through another SOCKS server, you can simply use a SOCKS connector from the following SOCKS client package:

You can now create a SOCKS Client instance like this:

See also the example #11.

Proxy chaining can happen on the server side and/or the client side:

Install

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

See also the CHANGELOG for details about version upgrades.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

To run the test suite, go to the project root and run:

License

MIT, see LICENSE

More


All versions of socks-server with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
react/event-loop Version 0.3.*|0.4.*
react/socket Version ^0.7
react/stream Version ^0.6 || ^0.5 || ^0.4.2
react/promise Version ^2.1 || ^1.2
evenement/evenement Version ~1.0|~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package clue/socks-server contains the following files

Loading the files please wait ....