Compare commits

...

4 Commits

Author SHA1 Message Date
AJ ONeal 1061dd4c71 typo fix README 2018-08-06 17:42:44 -06:00
AJ ONeal db15b22e40 update usage 2018-08-06 13:04:22 -06:00
AJ ONeal bfdabd1228 update Telebit instructions 2018-08-02 12:40:20 -06:00
AJ ONeal ccf0f28da7 add Telebit instructions 2018-08-02 12:38:44 -06:00
2 changed files with 33 additions and 6 deletions

View File

@ -38,6 +38,28 @@ You can also use HTTP.
curl http://localhost:4080
```
## Testing Beyond Localhost
You can use [Telebit](https://telebit.cloud) to share the experience with friends and loved ones:
Completely userspace installation:
```
curl -fsSL https://get.telebit.cloud | bash
```
Easy configuration:
```
~/telebit http 4080
> Forwarding https://lucky-duck-42.telebit.fun => localhost:4080
~/telebit tcp 4080
> Forwarding telebit.cloud:1234 => localhost:4080
```
Caveat: Due to a bug in telebit you must send 'hello' in telnet to establish a connection.
# API Docs
The API docs and examples can be seen at <http://localhost:4080>
@ -93,7 +115,7 @@ Not Implemented
I don't think these things would be difficult to add,
but I was having fun learning lots of other things
and I figured Some of these things I didn't implement
and I figured they're not that important.
* [ ] local log file
* [ ] Rooms

View File

@ -92,7 +92,7 @@ var broadcastMsg chan chatMsg
// Telnet
var wantsServerHello chan bufferedConn
var authTelnet chan telnetUser
var cleanTelnet chan telnetUser
var cleanTelnet chan telnetUser // intentionally blocking
// HTTP
var demuxHttpClient chan bufferedConn
@ -101,7 +101,7 @@ var valAuthReqs chan authReq
var delAuthReqs chan authReq
func usage() {
fmt.Fprintf(os.Stderr, "\nusage: go run chatserver.go\n")
fmt.Fprintf(os.Stderr, "\nusage: go run chatserver*.go\n")
flag.PrintDefaults()
fmt.Println()
@ -301,7 +301,7 @@ func main() {
virginConns = make(chan net.Conn, 128)
// TCP & Authentication
telnetConns := make(map[bufferedConn]telnetUser)
telnetConns := make(map[string]telnetUser)
wantsServerHello = make(chan bufferedConn, 128)
authTelnet = make(chan telnetUser, 128)
@ -389,7 +389,12 @@ func main() {
case u := <-authTelnet:
// allow to receive messages
// (and be counted among the users)
telnetConns[u.bufConn] = u
_, ok := telnetConns[u.email]
if ok {
// this is a blocking channel, and that's important
cleanTelnet <- telnetConns[u.email]
}
telnetConns[u.email] = u
// is chan chan the right way to handle this?
u.userCount <- len(telnetConns)
broadcastMsg <- chatMsg{
@ -422,7 +427,7 @@ func main() {
close(u.newMsg)
// we can safely ignore this error, if any
u.bufConn.Close()
delete(telnetConns, u.bufConn)
delete(telnetConns, u.email)
case bufConn := <-gotClientHello:
go muxTcp(bufConn)
case bufConn := <-demuxHttpClient: