mirror of https://github.com/cbeuw/Cloak
Merge branch 'master' into notsure2
This commit is contained in:
commit
566874874d
|
|
@ -116,9 +116,6 @@ and will raise an error. See Issue #13.**
|
||||||
`KeepAlive` is the number of seconds to tell the OS to wait after no activity before sending TCP KeepAlive probes to the
|
`KeepAlive` is the number of seconds to tell the OS to wait after no activity before sending TCP KeepAlive probes to the
|
||||||
upstream proxy server. Zero or negative value disables it. Default is 0 (disabled).
|
upstream proxy server. Zero or negative value disables it. Default is 0 (disabled).
|
||||||
|
|
||||||
`StreamTimeout` is the number of seconds of no data *sent* after which the incoming Cloak client connection will be
|
|
||||||
terminated. Default is 300 seconds.
|
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
|
|
||||||
`UID` is your UID in base64.
|
`UID` is your UID in base64.
|
||||||
|
|
@ -158,8 +155,9 @@ Currently, `chrome` and `firefox` are supported.
|
||||||
Cloak server. Zero or negative value disables it. Default is 0 (disabled). Warning: Enabling it might make your server
|
Cloak server. Zero or negative value disables it. Default is 0 (disabled). Warning: Enabling it might make your server
|
||||||
more detectable as a proxy, but it will make the Cloak client detect internet interruption more quickly.
|
more detectable as a proxy, but it will make the Cloak client detect internet interruption more quickly.
|
||||||
|
|
||||||
`StreamTimeout` is the number of seconds of no data *received* after which the incoming proxy connection will be
|
`StreamTimeout` is the number of seconds of Cloak waits for an incoming connection from a proxy program to send any
|
||||||
terminated. Default is 300 seconds.
|
data, after which the connection will be closed by Cloak. Cloak will not enforce any timeout on TCP connections after it
|
||||||
|
is established.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type RawConfig struct {
|
type RawConfig struct {
|
||||||
ProxyBook map[string][]string
|
ProxyBook map[string][]string
|
||||||
BindAddr []string
|
BindAddr []string
|
||||||
BypassUID [][]byte
|
BypassUID [][]byte
|
||||||
RedirAddr string
|
RedirAddr string
|
||||||
PrivateKey []byte
|
PrivateKey []byte
|
||||||
AdminUID []byte
|
AdminUID []byte
|
||||||
DatabasePath string
|
DatabasePath string
|
||||||
StreamTimeout int
|
KeepAlive int
|
||||||
KeepAlive int
|
CncMode bool
|
||||||
CncMode bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// State type stores the global state of the program
|
// State type stores the global state of the program
|
||||||
|
|
@ -34,8 +33,6 @@ type State struct {
|
||||||
|
|
||||||
WorldState common.WorldState
|
WorldState common.WorldState
|
||||||
AdminUID []byte
|
AdminUID []byte
|
||||||
Timeout time.Duration
|
|
||||||
//KeepAlive time.Duration
|
|
||||||
|
|
||||||
BypassUID map[[16]byte]struct{}
|
BypassUID map[[16]byte]struct{}
|
||||||
StaticPv crypto.PrivateKey
|
StaticPv crypto.PrivateKey
|
||||||
|
|
@ -153,12 +150,6 @@ func InitState(preParse RawConfig, worldState common.WorldState) (sta *State, er
|
||||||
sta.Panel = MakeUserPanel(manager)
|
sta.Panel = MakeUserPanel(manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
if preParse.StreamTimeout == 0 {
|
|
||||||
sta.Timeout = time.Duration(300) * time.Second
|
|
||||||
} else {
|
|
||||||
sta.Timeout = time.Duration(preParse.StreamTimeout) * time.Second
|
|
||||||
}
|
|
||||||
|
|
||||||
if preParse.KeepAlive <= 0 {
|
if preParse.KeepAlive <= 0 {
|
||||||
sta.ProxyDialer = &net.Dialer{KeepAlive: -1}
|
sta.ProxyDialer = &net.Dialer{KeepAlive: -1}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -138,16 +138,15 @@ func generateClientConfigs(rawConfig client.RawConfig, state common.WorldState)
|
||||||
|
|
||||||
func basicServerState(ws common.WorldState, db *os.File) *server.State {
|
func basicServerState(ws common.WorldState, db *os.File) *server.State {
|
||||||
var serverConfig = server.RawConfig{
|
var serverConfig = server.RawConfig{
|
||||||
ProxyBook: map[string][]string{"shadowsocks": {"tcp", "fake.com:9999"}, "openvpn": {"udp", "fake.com:9999"}},
|
ProxyBook: map[string][]string{"shadowsocks": {"tcp", "fake.com:9999"}, "openvpn": {"udp", "fake.com:9999"}},
|
||||||
BindAddr: []string{"fake.com:9999"},
|
BindAddr: []string{"fake.com:9999"},
|
||||||
BypassUID: [][]byte{bypassUID[:]},
|
BypassUID: [][]byte{bypassUID[:]},
|
||||||
RedirAddr: "fake.com:9999",
|
RedirAddr: "fake.com:9999",
|
||||||
PrivateKey: privateKey,
|
PrivateKey: privateKey,
|
||||||
AdminUID: nil,
|
AdminUID: nil,
|
||||||
DatabasePath: db.Name(),
|
DatabasePath: db.Name(),
|
||||||
StreamTimeout: 300,
|
KeepAlive: 15,
|
||||||
KeepAlive: 15,
|
CncMode: false,
|
||||||
CncMode: false,
|
|
||||||
}
|
}
|
||||||
state, err := server.InitState(serverConfig, ws)
|
state, err := server.InitState(serverConfig, ws)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue