mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-08-14 05:11:47 +00:00
feat: options to disable update check & fix client lazy mode
This commit is contained in:
@@ -361,15 +361,21 @@ func runClient(cmd *cobra.Command, args []string) {
|
||||
logger.Fatal("failed to load client config", zap.Error(err))
|
||||
}
|
||||
|
||||
c, err := client.NewReconnectableClient(hyConfig, connectLog, config.Lazy)
|
||||
c, err := client.NewReconnectableClient(hyConfig, func(c client.Client, count int) {
|
||||
connectLog(count)
|
||||
// On the client side, we start checking for updates after we successfully connect
|
||||
// to the server, which, depending on whether lazy mode is enabled, may or may not
|
||||
// be immediately after the client starts. We don't want the update check request
|
||||
// to interfere with the lazy mode option.
|
||||
if count == 1 && !disableUpdateCheck {
|
||||
go runCheckUpdateClient(c)
|
||||
}
|
||||
}, config.Lazy)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to initialize client", zap.Error(err))
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
// TODO: add option to disable update checking
|
||||
go runCheckUpdateClient(c) // TODO: fix lazy mode
|
||||
|
||||
uri := config.URI()
|
||||
logger.Info("use this URI to share your server", zap.String("uri", uri))
|
||||
if showQR {
|
||||
@@ -622,12 +628,7 @@ func (f *obfsConnFactory) New(addr net.Addr) (net.PacketConn, error) {
|
||||
}
|
||||
|
||||
func connectLog(count int) {
|
||||
if count == 1 {
|
||||
logger.Info("connected to server")
|
||||
} else {
|
||||
// Not the first time, we have reconnected
|
||||
logger.Info("reconnected to server", zap.Int("count", count))
|
||||
}
|
||||
logger.Info("connected to server", zap.Int("count", count))
|
||||
}
|
||||
|
||||
type socks5Logger struct{}
|
||||
|
Reference in New Issue
Block a user