Skip to content

Commit a5b564e

Browse files
committed
added docs, shortened disconnect sequence
1 parent 141258b commit a5b564e

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# chisel
22

3-
<!--
4-
![chisel](https://cloud.githubusercontent.com/assets/633843/6539989/7ec2d6ac-c4db-11e4-8648-6d2a462ded81.jpg)
5-
-->
6-
73
Chisel is an HTTP client and server which acts as a TCP proxy. Chisel useful in situations where you only have access to HTTP, for example – behind a corporate firewall. Chisel is very similar to [crowbar](https://github.com/q3k/crowbar) though achieves **much** higher [performance](#performance). **Warning** This is beta software.
84

95
![overview](https://docs.google.com/drawings/d/1p53VWxzGNfy8rjr-mW8pvisJmhkoLl82vAgctO_6f1w/pub?w=960&h=720)
@@ -12,14 +8,14 @@ Chisel is an HTTP client and server which acts as a TCP proxy. Chisel useful in
128

139
**Binaries**
1410

15-
See [Releases](releases/)
11+
See [Releases](https://github.com/jpillora/chisel/releases)
1612

1713
**Source**
1814

19-
```
20-
# Server
15+
``` sh
16+
# chisel server
2117
$ go get -v github.com/jpillora/chisel/chiseld
22-
# Client
18+
# chisel client
2319
$ go get -v github.com/jpillora/chisel/chisel-forward
2420
```
2521

@@ -36,23 +32,23 @@ $ go get -v github.com/jpillora/chisel/chisel-forward
3632
A [demo app](https://chisel-demo.herokuapp.com) on Heroku is running this `chiseld` server:
3733

3834
``` sh
39-
# listen on $PORT, require password 'foobar', proxy web requests to 'http://example.com'
4035
$ chiseld --auth foobar --port $PORT --proxy http://example.com
36+
# listens on $PORT, requires password 'foobar', proxy web requests to 'http://example.com'
4137
```
4238

4339
This demo app is also running a file server on 0.0.0.0:3000 (which is normally inaccessible
4440
due to Heroku's firewall). However, if we tunnel in with:
4541

4642
``` sh
47-
# connect to 'https://chisel-demo.herokuapp.com', using password 'foobar',
48-
# tunnel your localhost:3000 to the server's localhost:3000
4943
$ chisel-forward --auth foobar https://chisel-demo.herokuapp.com 3000
44+
# connects to 'https://chisel-demo.herokuapp.com', using password 'foobar',
45+
# tunnels your localhost:3000 to the server's localhost:3000
5046
```
5147

5248
Then open [localhost:3000/](http://localhost:3000/), we should
5349
see a directory listing of the demo app's root. Also, if we visit
54-
https://chisel-demo.herokuapp.com we should see that the server's
55-
default proxy is pointing at http://example.com.
50+
[the demo](https://chisel-demo.herokuapp.com) in the browser we should see that the server's
51+
default proxy is pointing at [example.com](http://example.com).
5652

5753
### Usage
5854

@@ -188,13 +184,13 @@ Note, we're using an in-memory "file" server on localhost for these tests
188184
:4001 => 100000000 bytes in 36.332395213s
189185
```
190186

191-
See [test/](tree/master/test/)
187+
See [test/](test/)
192188

193189
### Known Issues
194190

195191
* **WebSockets support is required**
196192
* IaaS providers all will support WebSockets
197-
* Unless they run a HTTP only proxy in front of your servers, in which case I'd argue that you've been downgraded to PaaS.
193+
* Unless an unsupporting HTTP proxy has been forced in front of you, in which case I'd argue that you've been downgraded to PaaS.
198194
* PaaS providers vary in their support for WebSockets
199195
* Heroku has full support
200196
* Openshift has full support though connections are only accepted on ports 8443 and 8080
@@ -211,7 +207,6 @@ See [test/](tree/master/test/)
211207

212208
### Todo
213209

214-
* Add tests (Bonus: Add benchmarks)
215210
* Users file with white-listed remotes
216211
* Pass in TLS server configuration
217212
* Encrypt data with `auth` as the symmetric key

chisel-forward/client/client.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"net/url"
88
"regexp"
99
"strings"
10-
"sync"
1110
"time"
1211

1312
"github.com/hashicorp/yamux"
@@ -149,22 +148,17 @@ func (c *Client) start() {
149148
}
150149
b.Reset()
151150

152-
//closed state
151+
//signal is connected
153152
connected := make(chan bool)
154-
var o sync.Once
155-
closed := func() {
156-
c.Infof("Disconnected\n")
157-
close(connected)
158-
}
159-
160153
c.Infof("Connected\n")
161154

162155
//poll websocket state
163156
go func() {
164157
for {
165158
if c.session.IsClosed() {
166159
connerr = c.Errorf("disconnected")
167-
o.Do(closed)
160+
c.Infof("Disconnected\n")
161+
close(connected)
168162
break
169163
}
170164
time.Sleep(100 * time.Millisecond)

0 commit comments

Comments
 (0)