From 91eb3395b96a0fdccc7e947096d0b5a21558270c Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 4 Dec 2024 15:25:09 -0800 Subject: [PATCH] update createProClient --- internalsdk/utils.go | 45 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/internalsdk/utils.go b/internalsdk/utils.go index 20cb586dc..c2dd80cf7 100644 --- a/internalsdk/utils.go +++ b/internalsdk/utils.go @@ -18,7 +18,6 @@ import ( "github.com/getlantern/lantern-client/internalsdk/common" "github.com/getlantern/lantern-client/internalsdk/pro" "github.com/getlantern/lantern-client/internalsdk/protos" - "github.com/getlantern/lantern-client/internalsdk/webclient" "github.com/getlantern/pathdb" "golang.org/x/crypto/pbkdf2" "google.golang.org/protobuf/proto" @@ -27,32 +26,24 @@ import ( // createProClient creates a new instance of ProClient with the given client session information func createProClient(session ClientSession, platform string) pro.ProClient { - dialTimeout := 30 * time.Second - if platform == "ios" { - dialTimeout = 20 * time.Second - } - webclientOpts := &webclient.Opts{ - Timeout: dialTimeout, - UserConfig: func() common.UserConfig { - internalHeaders := map[string]string{ - common.PlatformHeader: platform, - common.AppVersionHeader: common.ApplicationVersion, - } - deviceID, _ := session.GetDeviceID() - userID, _ := session.GetUserID() - token, _ := session.GetToken() - lang, _ := session.Locale() - return common.NewUserConfig( - common.DefaultAppName, - deviceID, - userID, - token, - internalHeaders, - lang, - ) - }, - } - return pro.NewClient(fmt.Sprintf("https://%s", common.ProAPIHost), webclientOpts) + return pro.NewClient(fmt.Sprintf("https://%s", common.ProAPIHost), func() common.UserConfig { + internalHeaders := map[string]string{ + common.PlatformHeader: platform, + common.AppVersionHeader: common.ApplicationVersion, + } + deviceID, _ := session.GetDeviceID() + userID, _ := session.GetUserID() + token, _ := session.GetToken() + lang, _ := session.Locale() + return common.NewUserConfig( + common.DefaultAppName, + deviceID, + userID, + token, + internalHeaders, + lang, + ) + }) } func BytesToFloat64LittleEndian(b []byte) (float64, error) {