Skip to content

Commit

Permalink
0.34.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yinqiwen committed Jun 10, 2018
1 parent 566bef4 commit a168a22
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GSnova: Private Proxy Solution.
GSnova: Private Proxy Solution & Network Troubleshooting Tool.
[![Join the chat at https://gitter.im/gsnova/Lobby](https://badges.gitter.im/gsnova/Lobby.svg)](https://gitter.im/gsnova/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/yinqiwen/gsnova.svg?branch=master)](https://travis-ci.org/yinqiwen/gsnova)

Expand All @@ -24,8 +24,7 @@ GSnova: Private Proxy Solution.
- http/https
- http2
- websocket
- tcp
- tls
- tcp/tls
- quic
- kcp
- ssh
Expand All @@ -48,6 +47,9 @@ GSnova: Private Proxy Solution.
- P2P/P2S2P Proxy
- P2P: Use TCP NAT tunnel for direct P2P commnunication if possible
- P2S2P: Use middle server for two peers to communication
- Use UPNP to expose port for remote p2p peer if possible.
- Low-memory Environments Support
- Use less than 20MB RSS memory at client/server side


# Usage
Expand Down Expand Up @@ -98,6 +100,8 @@ Usage of ./gsnova:
PID file (default ".gsnova.pid")
-ping_interval int
Channel ping interval seconds. (default 30)
-pprof string
PProf trouble shooting listen address
-proxy string
Proxy setting to connect remote server.
-remote value
Expand All @@ -112,6 +116,8 @@ Usage of ./gsnova:
TLS Cert file
-tls.key string
TLS Key file
-upnp int
UPNP port to expose for p2p.
-user string
Username for remote server to authorize. (default "gsnova")
-version
Expand All @@ -131,9 +137,9 @@ Usage of ./gsnova:
```
This would launch a running instance listening at serveral ports with different transport protocol.

The server can also be deployed to serveral PAAS service like heroku/openshift and some docker host servce.
The server can also be deployed to serveral PAAS service like heroku/openshift and some docker host service.

## Deploy & Run Client(PC)
## Deploy & Run Client

### Run From Command Line
```
Expand All @@ -150,7 +156,8 @@ This is a sample for [client.json](https://github.com/yinqiwen/gsnova/blob/maste

### Advanced Usage
#### Multi-Hop Proxy
GSnova support more than ONE remote server as the next hops, just add moren `-remote server` arguments to enable multi-hop proxy.
GSnova support more than ONE remote server as the next hops, just add more `-remote server` arguments to enable multi-hop proxy.
This would use `http2://app1.openshiftapps.com` as the first proxy ho and use `wss://app2.herokuapp.com` as the final proxy hop.
```shell
./gsnova -cmd -client -listen :48101 -remote http2://app1.openshiftapps.com -remote wss://app2.herokuapp.com -key 809240d3a021449f6e67aa73221d42df942a308a
```
Expand All @@ -159,7 +166,8 @@ GSnova support more than ONE remote server as the next hops, just add moren `-re
- It's only works on linux.

#### MITM Proxy
GSnova support running the client as a MITM proxy to capture HTTP(S) packets for web debuging.
GSnova support running the client as a MITM proxy to capture HTTP(S) packets for web debuging.
This would capture HTTP(S) traffic packets into local dist file `httpdump.log`.
```shell
./gsnova -cmd -client -listen :48101 -remote direct -mitm -httpdump.dst ./httpdump.log -httpdump.filter "*.google.com" -httpdump.filter "*.facebook.com"
```
Expand Down
20 changes: 14 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
_ "net/http/pprof"
"os"
"path/filepath"
"runtime"
"runtime/debug"
"strings"
"time"

"github.com/yinqiwen/gotoolkit/ots"
"github.com/yinqiwen/gsnova/common/channel"
Expand Down Expand Up @@ -67,6 +70,7 @@ func main() {
var whilteList, blackList channel.HopServers
flag.Var(&whilteList, "whitelist", "Proxy whitelist item config")
flag.Var(&blackList, "blackList", "Proxy blacklist item config")
gcInterval := flag.Int("gc_interval", -1, "Manual GC every interval secs.")

//client options
admin := flag.String("admin", "", "Client Admin listen address")
Expand Down Expand Up @@ -123,12 +127,16 @@ func main() {
go func() {
http.ListenAndServe(*pprofAddr, nil)
}()
// go func() {
// for {
// debug.FreeOSMemory()
// time.Sleep(1 * time.Second)
// }
// }()

}
if *gcInterval > 0 {
go func() {
for {
runtime.GC()
debug.FreeOSMemory()
time.Sleep(time.Duration(*gcInterval) * time.Second)
}
}()
}
if runAsClient {
options := local.ProxyOptions{
Expand Down
5 changes: 5 additions & 0 deletions server.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
//AllowedUser
"User": "*,gsnova"
},
//Limit user 'abc' bandwidth to 256KB/s
"RateLimit":{
"abc": "256K",
"*":"-1"
},
"Mux":{
"MaxStreamWindow": "512K",
"StreamMinRefresh":"32K",
Expand Down

0 comments on commit a168a22

Please sign in to comment.