core: do not log TLS handshake errors by default, option to enable (#1652)

* core: do not log TLS handshake errors by default, option to enable

* update simplexmq
This commit is contained in:
Evgeny Poberezkin
2022-12-27 12:05:13 +00:00
committed by GitHub
parent 90a20cd52f
commit 13090ff6ed
6 changed files with 16 additions and 9 deletions

View File

@@ -3870,8 +3870,9 @@ chatCommandP =
netCfgP = do
socksProxy <- "socks=" *> ("off" $> Nothing <|> "on" $> Just defaultSocksProxy <|> Just <$> strP)
t_ <- optional $ " timeout=" *> A.decimal
logErrors <- " log=" *> onOffP <|> pure False
let tcpTimeout = 1000000 * fromMaybe (maybe 5 (const 10) socksProxy) t_
pure $ fullNetworkConfig socksProxy tcpTimeout
pure $ fullNetworkConfig socksProxy tcpTimeout logErrors
dbKeyP = nonEmptyKey <$?> strP
nonEmptyKey k@(DBEncryptionKey s) = if null s then Left "empty key" else Right k
autoAcceptP =

View File

@@ -84,6 +84,11 @@ chatOpts appDir defaultDbFileName = do
<> help "TCP timeout, seconds (default: 5/10 without/with SOCKS5 proxy)"
<> value 0
)
logTLSErrors <-
switch
( long "log-tls-errors"
<> help "Log TLS errors"
)
logConnections <-
switch
( long "connections"
@@ -152,7 +157,7 @@ chatOpts appDir defaultDbFileName = do
{ dbFilePrefix,
dbKey,
smpServers,
networkConfig = fullNetworkConfig socksProxy $ useTcpTimeout socksProxy t,
networkConfig = fullNetworkConfig socksProxy (useTcpTimeout socksProxy t) logTLSErrors,
logConnections,
logServerHosts,
logAgent,
@@ -167,10 +172,10 @@ chatOpts appDir defaultDbFileName = do
useTcpTimeout p t = 1000000 * if t > 0 then t else maybe 5 (const 10) p
defaultDbFilePath = combine appDir defaultDbFileName
fullNetworkConfig :: Maybe SocksProxy -> Int -> NetworkConfig
fullNetworkConfig socksProxy tcpTimeout =
fullNetworkConfig :: Maybe SocksProxy -> Int -> Bool -> NetworkConfig
fullNetworkConfig socksProxy tcpTimeout logTLSErrors =
let tcpConnectTimeout = (tcpTimeout * 3) `div` 2
in defaultNetworkConfig {socksProxy, tcpTimeout, tcpConnectTimeout}
in defaultNetworkConfig {socksProxy, tcpTimeout, tcpConnectTimeout, logTLSErrors}
parseSMPServers :: ReadM [SMPServerWithAuth]
parseSMPServers = eitherReader $ parseAll smpServersP . B.pack