@@ -7,7 +7,7 @@ Async HTTP CONNECT proxy connector, use any TCP/IP protocol through an HTTP prox
7
7
* [ Quickstart example] ( #quickstart-example )
8
8
* [ Usage] ( #usage )
9
9
* [ ConnectorInterface] ( #connectorinterface )
10
- * [ create ()] ( #create )
10
+ * [ connect ()] ( #connect )
11
11
* [ ProxyConnector] ( #proxyconnector )
12
12
* [ Install] ( #install )
13
13
* [ Tests] ( #tests )
@@ -25,7 +25,7 @@ $connector = new TcpConnector($loop);
25
25
$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
26
26
$ssl = new SecureConnector($proxy, $loop);
27
27
28
- $ssl->create ('google.com', 443)->then(function (Stream $stream) {
28
+ $ssl->connect ('google.com: 443' )->then(function (ConnectionInterface $stream) {
29
29
$stream->write("GET / HTTP/1.1\r\nHost: google.com\r\nConnection: close\r\n\r\n");
30
30
$stream->on('data', function ($chunk) {
31
31
echo $chunk;
@@ -59,17 +59,17 @@ HTTP CONNECT proxy.
59
59
60
60
The interface only offers a single method:
61
61
62
- #### create ()
62
+ #### connect ()
63
63
64
- The ` create (string $host, int $port ): PromiseInterface<Stream , Exception>` method
64
+ The ` connect (string $uri ): PromiseInterface<ConnectionInterface , Exception>` method
65
65
can be used to establish a streaming connection.
66
66
It returns a [ Promise] ( https://github.com/reactphp/promise ) which either
67
- fulfills with a [ Stream ] ( https://github.com/reactphp/stream ) or
67
+ fulfills with a [ ConnectionInterface ] ( https://github.com/reactphp/socket-client#connectioninterface ) or
68
68
rejects with an ` Exception ` :
69
69
70
70
``` php
71
- $connector->create ('google.com', 443)->then(
72
- function (Stream $stream) {
71
+ $connector->connect ('google.com: 443' )->then(
72
+ function (ConnectionInterface $stream) {
73
73
// connection successfully established
74
74
},
75
75
function (Exception $error) {
@@ -121,7 +121,7 @@ connector is actually inherently a general-purpose plain TCP/IP connector:
121
121
``` php
122
122
$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
123
123
124
- $proxy->create ('smtp.googlemail.com', 587)->then(function (Stream $stream) {
124
+ $proxy->connect ('smtp.googlemail.com: 587' )->then(function (ConnectionInterface $stream) {
125
125
$stream->write("EHLO local\r\n");
126
126
$stream->on('data', function ($chunk) use ($stream) {
127
127
echo $chunk;
@@ -141,7 +141,7 @@ instance:
141
141
$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
142
142
$ssl = new SecureConnector($proxy, $loop);
143
143
144
- $ssl->create ('smtp.googlemail.com', 465)->then(function (Stream $stream) {
144
+ $ssl->connect ('smtp.googlemail.com: 465' )->then(function (ConnectionInterface $stream) {
145
145
$stream->write("EHLO local\r\n");
146
146
$stream->on('data', function ($chunk) use ($stream) {
147
147
echo $chunk;
@@ -163,7 +163,7 @@ instance to create a secure connection to the proxy:
163
163
$ssl = new SecureConnector($connector, $loop);
164
164
$proxy = new ProxyConnector('127.0.0.1:443', $ssl);
165
165
166
- $proxy->create ('smtp.googlemail.com', 587);
166
+ $proxy->connect ('smtp.googlemail.com: 587' );
167
167
```
168
168
169
169
## Install
0 commit comments