Skip to content

Commit a76469b

Browse files
authored
Merge pull request #4 from onyas/docs
doc
2 parents da11569 + 90b6aad commit a76469b

File tree

7 files changed

+70
-32
lines changed

7 files changed

+70
-32
lines changed

README.md

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
## Usage
2-
go run main.go -client -proxyServer https://yourProxyServer.com
3-
go run main.go -client -port 3000
4-
5-
6-
## Debug stage
7-
8-
[Data Race Detector](https://go.dev/doc/articles/race_detector)
9-
```
10-
go run -race main.go
112

12-
go run -race main.go -client
3+
### Server side
4+
1. Fork and clone this repo
5+
2. Deploy to heroku
6+
```
7+
//create app in heroku
8+
heroku create
9+
//deploy your app to heroku
10+
git push heroku main
11+
```
12+
13+
### Client side
1314
```
14-
request http://localhost:8080/ through postman
15+
go run main.go -client -proxyServer yourProxyServer.herokuapp.com
1516

16-
## Development with Heroku locally
17-
```
18-
//start server locally
19-
heroku local -f Procfile.local
20-
21-
//start client locally
22-
go run main.go -client
17+
go run main.go -client -port 3000
2318
```
2419
25-
## Deploy to Heroku
20+
Now your local server is exposed to the internet, you could visit it by http://yourProxyServer.herokuapp.com
2621
27-
```
28-
heroku login
29-
//create app in heroku
30-
heroku create
31-
//deploy your app to heroku
32-
git push heroku main
33-
//open you app in browser
34-
heroku open
3522
36-
//check logs
37-
heroku logs --tail
38-
```
23+
## Useful docs
24+
- [Architecture of ggrok](./docs/architecture.md)
25+
- [How to run this project locally](./docs/run-locally.md)
26+
- [How to debug concurrent issues](./docs/debug.md)
27+
- [Useful Heroku command](./docs/heroku-command.md)

core/ggrok-client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewClient(s string, p int) *GGrokClient {
2424
return &GGrokClient{RemoteServer: s, ProxyLocalPort: p}
2525
}
2626

27-
func (ggclient *GGrokClient) Start() {
27+
func (ggclient *GGrokClient) Proxy() {
2828
interrupt := make(chan os.Signal, 1)
2929
signal.Notify(interrupt, os.Interrupt)
3030

docs/architecture.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Architecture
2+
3+
This document describes the high-level architecture of ggrok. If you want to familiarize yourself with the code base, you are just in the right place!
4+
5+
## Bird's Eye View
6+
7+
```mermaid
8+
9+
flowchart LR
10+
PublicNet <--http--> ggrok-server
11+
ggrok-server <-- websocket --> ggrok-client
12+
PublicNet x--x LocalServer
13+
LocalServer <--http--> ggrok-client
14+
15+
```
16+
17+
On the highest level, ggrok is a thing that exposes your local server to the internet, so that others can visit your local server easily.

docs/debug.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
## Debug stage
3+
4+
[Data Race Detector](https://go.dev/doc/articles/race_detector)
5+
```
6+
go run -race main.go
7+
8+
go run -race main.go -client
9+
```
10+
request http://localhost:8080/ through postman

docs/heroku-command.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Deploy to Heroku
2+
3+
```
4+
heroku login
5+
//create app in heroku
6+
heroku create
7+
//deploy your app to heroku
8+
git push heroku main
9+
//open you app in browser
10+
heroku open
11+
12+
//check logs
13+
heroku logs --tail
14+
```

docs/run-locally.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Development with Heroku locally
2+
```
3+
//start server locally
4+
heroku local -f Procfile.local
5+
6+
//start client locally
7+
go run main.go -client
8+
```

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func startProxy(port int) {
6666
defer close(done)
6767

6868
c := core.NewClient(proxyServer, port)
69-
c.Start()
69+
c.Proxy()
7070
}()
7171
<-done
7272

0 commit comments

Comments
 (0)