mirror of https://github.com/cbeuw/Cloak
Remove StreamTimeout from server completely
This commit is contained in:
parent
e77fd4c446
commit
d5a003d6d6
|
|
@ -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
|
||||
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
|
||||
|
||||
`UID` is your UID in base64.
|
||||
|
|
@ -152,8 +149,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
|
||||
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
|
||||
terminated. Default is 300 seconds.
|
||||
`StreamTimeout` is the number of seconds of Cloak waits for an incoming connection from a proxy program to send any
|
||||
data, after which the connection will be closed by Cloak. Cloak will not enforce any timeout on TCP connections after it
|
||||
is established.
|
||||
|
||||
## Setup
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,15 @@ import (
|
|||
)
|
||||
|
||||
type RawConfig struct {
|
||||
ProxyBook map[string][]string
|
||||
BindAddr []string
|
||||
BypassUID [][]byte
|
||||
RedirAddr string
|
||||
PrivateKey []byte
|
||||
AdminUID []byte
|
||||
DatabasePath string
|
||||
StreamTimeout int
|
||||
KeepAlive int
|
||||
CncMode bool
|
||||
ProxyBook map[string][]string
|
||||
BindAddr []string
|
||||
BypassUID [][]byte
|
||||
RedirAddr string
|
||||
PrivateKey []byte
|
||||
AdminUID []byte
|
||||
DatabasePath string
|
||||
KeepAlive int
|
||||
CncMode bool
|
||||
}
|
||||
|
||||
// State type stores the global state of the program
|
||||
|
|
@ -34,8 +33,6 @@ type State struct {
|
|||
|
||||
WorldState common.WorldState
|
||||
AdminUID []byte
|
||||
Timeout time.Duration
|
||||
//KeepAlive time.Duration
|
||||
|
||||
BypassUID map[[16]byte]struct{}
|
||||
StaticPv crypto.PrivateKey
|
||||
|
|
@ -153,12 +150,6 @@ func InitState(preParse RawConfig, worldState common.WorldState) (sta *State, er
|
|||
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 {
|
||||
sta.ProxyDialer = &net.Dialer{KeepAlive: -1}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -138,16 +138,15 @@ func generateClientConfigs(rawConfig client.RawConfig, state common.WorldState)
|
|||
|
||||
func basicServerState(ws common.WorldState, db *os.File) *server.State {
|
||||
var serverConfig = server.RawConfig{
|
||||
ProxyBook: map[string][]string{"shadowsocks": {"tcp", "fake.com:9999"}, "openvpn": {"udp", "fake.com:9999"}},
|
||||
BindAddr: []string{"fake.com:9999"},
|
||||
BypassUID: [][]byte{bypassUID[:]},
|
||||
RedirAddr: "fake.com:9999",
|
||||
PrivateKey: privateKey,
|
||||
AdminUID: nil,
|
||||
DatabasePath: db.Name(),
|
||||
StreamTimeout: 300,
|
||||
KeepAlive: 15,
|
||||
CncMode: false,
|
||||
ProxyBook: map[string][]string{"shadowsocks": {"tcp", "fake.com:9999"}, "openvpn": {"udp", "fake.com:9999"}},
|
||||
BindAddr: []string{"fake.com:9999"},
|
||||
BypassUID: [][]byte{bypassUID[:]},
|
||||
RedirAddr: "fake.com:9999",
|
||||
PrivateKey: privateKey,
|
||||
AdminUID: nil,
|
||||
DatabasePath: db.Name(),
|
||||
KeepAlive: 15,
|
||||
CncMode: false,
|
||||
}
|
||||
state, err := server.InitState(serverConfig, ws)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue