Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest flashlight with no proxied package and only kindling #1293

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions desktop/autoupdate/autoupdate.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package autoupdate

import (
"errors"
"fmt"
"net/http"
"strings"
"sync"
"sync/atomic"
"time"

"github.com/getlantern/autoupdate"
"github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/golog"
"github.com/getlantern/i18n"
notify "github.com/getlantern/notifier"
Expand All @@ -28,18 +24,13 @@ var (

cfgMutex sync.RWMutex
watchForUpdateOnce sync.Once
httpClient atomic.Value
fnIconURL func() string
)

// Configure sets the CA certificate to pin for the TLS auto-update connection.
func Configure(updateURL, updateCA string, iconURL func() string) {
setUpdateURL(updateURL)
fnIconURL = iconURL
httpClient.Store(
&http.Client{
Transport: proxied.ChainedThenFrontedWith(updateCA),
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are losing track of the update CA here -- have to think on that one

enableAutoupdate()
}

Expand All @@ -65,14 +56,10 @@ func enableAutoupdate() {
}

func CheckUpdates() (string, error) {
hc := httpClient.Load()
if hc == nil {
return "", errors.New("autoupdate not configured")
}
return autoupdate.CheckMobileUpdate(&autoupdate.Config{
CurrentVersion: Version,
URL: getUpdateURL(),
HTTPClient: hc.(*http.Client),
HTTPClient: common.GetHTTPClient(),
PublicKey: PublicKey,
})
}
Expand All @@ -85,7 +72,7 @@ func watchForUpdate() {
CheckInterval: 4 * time.Hour,
URL: getUpdateURL(),
PublicKey: PublicKey,
HTTPClient: httpClient.Load().(*http.Client),
HTTPClient: common.GetHTTPClient(),
})
if err == nil {
notifyUser(newVersion)
Expand Down
18 changes: 12 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ module github.com/getlantern/lantern-client

go 1.22.4

// replace github.com/getlantern/flashlight/v7 => ../flashlight
//replace github.com/getlantern/flashlight/v7 => ../flashlight

// replace github.com/getlantern/ipproxy => ../ipproxy
// replace github.com/getlantern/fronted => ../fronted
//replace github.com/getlantern/kindling => ../kindling

//replace github.com/getlantern/fronted => ../fronted

// replace github.com/getlantern/pathdb => ../pathDb/pathDb

replace github.com/elazarl/goproxy => github.com/getlantern/goproxy v0.0.0-20220805074304-4a43a9ed4ec6
Expand Down Expand Up @@ -37,8 +40,8 @@ require (
github.com/getlantern/eventual v1.0.0
github.com/getlantern/eventual/v2 v2.0.2
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c
github.com/getlantern/flashlight/v7 v7.6.178
github.com/getlantern/fronted v0.0.0-20250104035820-b06365fddbbf
github.com/getlantern/flashlight/v7 v7.6.180-0.20250129184939-e6d230be1238
github.com/getlantern/fronted v0.0.0-20250129184840-abcec12f754e
github.com/getlantern/geolookup v0.0.0-20230327091034-aebe73c6eef4
github.com/getlantern/golog v0.0.0-20230503153817-8e72de7e0a65
github.com/getlantern/hidden v0.0.0-20220104173330-f221c5a24770
Expand Down Expand Up @@ -85,12 +88,15 @@ require (
atomicgo.dev/cursor v0.2.0 // indirect
atomicgo.dev/keyboard v0.2.9 // indirect
atomicgo.dev/schedule v0.1.0 // indirect
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250113162209-efa808309e1e // indirect
github.com/alitto/pond/v2 v2.1.6 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
github.com/coder/websocket v1.8.12 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/getlantern/kindling v0.0.0-20250129184912-6fb98583d540 // indirect
github.com/getlantern/lantern-water v0.0.0-20241218135103-60224336cf1d // indirect
github.com/getlantern/sing-vmess v0.0.0-20241209111030-0f2c02b4eb9a // indirect
github.com/goccy/go-yaml v1.15.13 // indirect
github.com/gofrs/uuid/v5 v5.3.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
Expand All @@ -106,7 +112,7 @@ require (
require (
filippo.io/edwards25519 v1.0.0 // indirect
git.torproject.org/pluggable-transports/goptlib.git v1.2.0 // indirect
github.com/Jigsaw-Code/outline-sdk v0.0.17 // indirect
github.com/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629 // indirect
github.com/Jigsaw-Code/outline-ss-server v1.5.0 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/OperatorFoundation/Replicant-go/Replicant/v3 v3.0.23 // indirect
Expand Down Expand Up @@ -196,7 +202,7 @@ require (
github.com/getlantern/iptool v0.0.0-20230112135223-c00e863b2696 // indirect
github.com/getlantern/kcp-go/v5 v5.0.0-20220503142114-f0c1cd6e1b54 // indirect
github.com/getlantern/kcpwrapper v0.0.0-20230327091313-c12d7c17c6de // indirect
github.com/getlantern/keepcurrent v0.0.0-20221014183517-fcee77376b89 // indirect
github.com/getlantern/keepcurrent v0.0.0-20240126172110-2e0264ca385d // indirect
github.com/getlantern/keyman v0.0.0-20230503155501-4e864ca2175b // indirect
github.com/getlantern/lampshade v0.0.0-20201109225444-b06082e15f3a // indirect
github.com/getlantern/lantern-algeneva v0.0.0-20240930181006-6d3c00db1d5d // indirect
Expand Down
28 changes: 16 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ git.torproject.org/pluggable-transports/goptlib.git v1.2.0/go.mod h1:4PBMl1dg7/3
github.com/1Password/srp v0.2.0 h1:PZKAafEyExnwevliL6d2+FDhJXZ0phxqiG2OeIaj9Xk=
github.com/1Password/srp v0.2.0/go.mod h1:LIGqQ7eEA0UJT98j7sXk60QWVpHJ3g00BX6LOm9kYTc=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Jigsaw-Code/outline-sdk v0.0.17 h1:xkGsp3fs+5EbIZEeCEPI1rl0oyCrOLuO7YSK0gB75HE=
github.com/Jigsaw-Code/outline-sdk v0.0.17/go.mod h1:CFDKyGZA4zatKE4vMLe8TyQpZCyINOeRFbMAmYHxodw=
github.com/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629 h1:sHi1X4vwtNNBUDCbxynGXe7cM/inwTbavowHziaxlbk=
github.com/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629/go.mod h1:CFDKyGZA4zatKE4vMLe8TyQpZCyINOeRFbMAmYHxodw=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250113162209-efa808309e1e h1:OtredOaXb4X0FIKsg4B319CTaMmaodVTdbvjiO66CHI=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250113162209-efa808309e1e/go.mod h1:c1QUAaN6rhYusQ4HLWLQ7xb7zmLaePNUS+Y1PwRo5Ls=
github.com/Jigsaw-Code/outline-ss-server v1.5.0 h1:Vz+iS0xR7i3PrLD82pzFFwZ9fsh6zrNawMeYERR8VTc=
github.com/Jigsaw-Code/outline-ss-server v1.5.0/go.mod h1:KaebwBiCWDSkgsJrJIbGH0szON8CZq4LgQaFV8v3RM4=
github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs=
Expand Down Expand Up @@ -320,12 +322,12 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+
github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/flashlight/v7 v7.6.178 h1:HRaxmBH6sqM1gbMFIpDV+kCvR6eoXN6kjcFOxL+mHHk=
github.com/getlantern/flashlight/v7 v7.6.178/go.mod h1:2HDjD6lx7W5hbTh3Vg572bHVFd9YZ4YODLl2b+d7JBw=
github.com/getlantern/flashlight/v7 v7.6.180-0.20250129184939-e6d230be1238 h1:yPAifZFAsmqEqFDpTOigLzPWMipmFYbkF8Ku1qMPSOE=
github.com/getlantern/flashlight/v7 v7.6.180-0.20250129184939-e6d230be1238/go.mod h1:ok6PZXi9Bfyz27Auj25hmNiQfofeLRcwIwBJlKMwf2I=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI=
github.com/getlantern/fronted v0.0.0-20250104035820-b06365fddbbf h1:bJ2js+u7+YNfckK3PJDtvKR4K9/60ZhFltou/39I9Xs=
github.com/getlantern/fronted v0.0.0-20250104035820-b06365fddbbf/go.mod h1:1EizEqHYPoLBVfjjSYAC1vcTSI++z/pDx7hEIpyTY+0=
github.com/getlantern/fronted v0.0.0-20250129184840-abcec12f754e h1:8PIYFbAAudnyn6LhMU+hqGEU6qUJ8Tt84LSs6QYD/tg=
github.com/getlantern/fronted v0.0.0-20250129184840-abcec12f754e/go.mod h1:/4g6lEMXHzkF/6WBr3vod4wh3tos632qSZGh7L/fIdg=
github.com/getlantern/geo v0.0.0-20241129152027-2fc88c10f91e h1:vpikNz6IzvEoqVYmiK5Uq+lE4TCzvMDqbZdxFbtGK1g=
github.com/getlantern/geo v0.0.0-20241129152027-2fc88c10f91e/go.mod h1:RjQ0krF8NTCc5xo2Q1995/vZBnYg33h8svn15do7dLg=
github.com/getlantern/geolookup v0.0.0-20230327091034-aebe73c6eef4 h1:Ju9l1RretVWJTNo2vpl/xAW8Dcuiyg5kJC6LRBpCigw=
Expand Down Expand Up @@ -379,11 +381,13 @@ github.com/getlantern/kcp-go/v5 v5.0.0-20220503142114-f0c1cd6e1b54 h1:JqIiaDpL6C
github.com/getlantern/kcp-go/v5 v5.0.0-20220503142114-f0c1cd6e1b54/go.mod h1:KFBWdR0PdEQK0JtGcE1lhAoYFVTRxWDFfYBARPb0t9Q=
github.com/getlantern/kcpwrapper v0.0.0-20230327091313-c12d7c17c6de h1:RS4Tx7aVExrAXsgvrXSln9iQ5HZNPpvHjJGM/MQH8ZE=
github.com/getlantern/kcpwrapper v0.0.0-20230327091313-c12d7c17c6de/go.mod h1:UVPVk1fNbqBceE4i+x/qbNxUNQ7gMACdOukoIbXM9jc=
github.com/getlantern/keepcurrent v0.0.0-20221014183517-fcee77376b89 h1:gjlTAADW8ZUrIey+u1ZtbVlI91bqI0Bu+GBxvRlBBqo=
github.com/getlantern/keepcurrent v0.0.0-20221014183517-fcee77376b89/go.mod h1:EtJEobtQH/HiQsZLyRjlrnq/fu7vfgnTMzhbmUqkZ3M=
github.com/getlantern/keepcurrent v0.0.0-20240126172110-2e0264ca385d h1:2/9rPC1xT+jWBnAe4mD6Q0LWkByFYGcTiKsmDWbv2T4=
github.com/getlantern/keepcurrent v0.0.0-20240126172110-2e0264ca385d/go.mod h1:enUAvxkJ15QUtTKOKoO9WJV2L5u33P8YmqkC+iu8iT4=
github.com/getlantern/keyman v0.0.0-20180207174507-f55e7280e93a/go.mod h1:FMf0g72BHs14jVcD8i8ubEk4sMB6JdidBn67d44i3ws=
github.com/getlantern/keyman v0.0.0-20230503155501-4e864ca2175b h1:iyEuk8ARQC9HfraqC4r3leBhU55R1TV7bAiyPYE54kA=
github.com/getlantern/keyman v0.0.0-20230503155501-4e864ca2175b/go.mod h1:ZJ+yDaZkJ/JU9j7EQa3UUh6ouedrNDDLA5OiowS1Iuk=
github.com/getlantern/kindling v0.0.0-20250129184912-6fb98583d540 h1:dRWUDDGSUdWFGxYYbTIRLJlAAXjjf2LZ7IGMGTsaeJg=
github.com/getlantern/kindling v0.0.0-20250129184912-6fb98583d540/go.mod h1:LHrgjBtlsAVHcEJmeJQVewCgtO1i8IepVinbbIiqAXM=
github.com/getlantern/lampshade v0.0.0-20201109225444-b06082e15f3a h1:z7G1v79GB1qRrkcbzF0nrLzV/+dwdGmamEZAp0ff+z0=
github.com/getlantern/lampshade v0.0.0-20201109225444-b06082e15f3a/go.mod h1:cGOfTjvllC9bcwS7cVW6tGT6fXc8Dki384uFjm7XBnw=
github.com/getlantern/lantern-algeneva v0.0.0-20240930181006-6d3c00db1d5d h1:ACBwPR4du54Qw+X5ajsbMqOFR8euGZRdMGkvTDS7I60=
Expand Down Expand Up @@ -531,6 +535,8 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
github.com/goccy/go-yaml v1.15.13 h1:Xd87Yddmr2rC1SLLTm2MNDcTjeO/GYo0JGiww6gSTDg=
github.com/goccy/go-yaml v1.15.13/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk=
github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down Expand Up @@ -954,8 +960,6 @@ github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBf
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down Expand Up @@ -1014,6 +1018,8 @@ github.com/templexxx/cpu v0.1.1 h1:isxHaxBXpYFWnk2DReuKkigaZyrjs2+9ypIdGP4h+HI=
github.com/templexxx/cpu v0.1.1/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
github.com/templexxx/xorsimd v0.4.3 h1:9AQTFHd7Bhk3dIT7Al2XeBX5DWOvsUPZCuhyAtNbHjU=
github.com/templexxx/xorsimd v0.4.3/go.mod h1:oZQcD6RFDisW2Am58dSAGwwL6rHjbzrlu25VDqfWkQg=
github.com/things-go/go-socks5 v0.0.5 h1:qvKaGcBkfDrUL33SchHN93srAmYGzb4CxSM2DPYufe8=
github.com/things-go/go-socks5 v0.0.5/go.mod h1:mtzInf8v5xmsBpHZVbIw2YQYhc4K0jRwzfsH64Uh0IQ=
github.com/ti-mo/conntrack v0.3.0 h1:572/72R9la2FVvO6CbsLiCmR48U3pgCvIlLKoUrExDU=
github.com/ti-mo/conntrack v0.3.0/go.mod h1:tPSYNx21TnjxGz99pLD/lAN4fuEViaJZz+pliMqnovk=
github.com/ti-mo/netfilter v0.3.1 h1:+ZTmeTx+64Jw2N/1gmqm42kruDWjQ90SMjWEB1e6VDs=
Expand All @@ -1037,8 +1043,6 @@ github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
github.com/vishvananda/netns v0.0.1 h1:JDkWS7Axy5ziNM3svylLhpSgqjPDb+BgVUbXoDo+iPw=
github.com/vishvananda/netns v0.0.1/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vulcand/oxy v1.4.2 h1:KibUVdKrwy7eXR3uHS2pYoZ9dCzKVcgDNHD2jkPZmxU=
github.com/vulcand/oxy v1.4.2/go.mod h1:Yq8OBb0XWU/7nPSglwUH5LS2Pcp4yvad8SVayobZbSo=
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
Expand Down
3 changes: 1 addition & 2 deletions internalsdk/analytics/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/flashlight/v7/util"
"github.com/getlantern/golog"
)
Expand Down Expand Up @@ -85,7 +84,7 @@ func (ga googleAnalytics) GetSessionValues(version, clientID, execHash string) u

// Start starts the analytics session with the given data.
func Start(deviceID, version string) *session {
s := newSession(deviceID, version, keepaliveInterval, proxied.ChainedThenFronted())
s := newSession(deviceID, version, keepaliveInterval, common.GetHTTPClient().Transport)
go s.keepalive()
return s
}
Expand Down
20 changes: 2 additions & 18 deletions internalsdk/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (

"net/http"
"strings"
"time"

"github.com/getlantern/flashlight/v7/proxied"
fcommon "github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/golog"

"github.com/getlantern/lantern-client/internalsdk/common"
Expand Down Expand Up @@ -51,22 +50,7 @@ type AuthClient interface {

// NewClient creates a new instance of AuthClient
func NewClient(baseURL string, userConfig func() common.UserConfig) AuthClient {
var httpClient *http.Client

if strings.HasSuffix(baseURL, common.APIBaseUrl) {
log.Debugf("Using Fronted proxy for auth client")
// iOS
// There is no use of chnained proxy in iOS since all requests will fail
httpClient = &http.Client{
Transport: proxied.Fronted("authClient-ios"),
Timeout: 30 * time.Second,
}
} else {
httpClient = &http.Client{
Transport: proxied.ChainedThenFronted(),
Timeout: 30 * time.Second,
}
}
var httpClient = fcommon.GetHTTPClient()
rc := webclient.NewRESTClient(&webclient.Opts{
BaseURL: baseURL,
OnBeforeRequest: func(client *resty.Client, req *http.Request) error {
Expand Down
12 changes: 3 additions & 9 deletions internalsdk/autoupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ package internalsdk

import (
"fmt"
"net/http"
"strings"

"github.com/getlantern/autoupdate"
fcommon "github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/flashlight/v7/ops"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/lantern-client/internalsdk/common"
)

var (
// XXX mobile does not respect the autoupdate global config
updateClient = &http.Client{Transport: proxied.ChainedThenFrontedWith("")}
)

// DeviceInfo provides information about a device for sending with ops when
// downloading and installing auto-updates
type DeviceInfo interface {
Expand Down Expand Up @@ -58,7 +52,7 @@ func deviceOps(name string, deviceInfo DeviceInfo) *ops.Op {
func DownloadUpdate(deviceInfo DeviceInfo, url, apkPath string, updater Updater) bool {
op := deviceOps("autoupdate_download", deviceInfo)
defer op.End()
err := autoupdate.UpdateMobile(url, apkPath, updater, updateClient)
err := autoupdate.UpdateMobile(url, apkPath, updater, fcommon.GetHTTPClient())
if err != nil {
op.FailIf(log.Errorf("Error downloading update: %v", err))
return false
Expand All @@ -78,7 +72,7 @@ func buildUpdateCfg() *autoupdate.Config {
return &autoupdate.Config{
CurrentVersion: common.ApplicationVersion,
URL: fmt.Sprintf("%s/update/%s", common.UpdateServerURL, strings.ToLower(common.DefaultAppName)),
HTTPClient: updateClient,
HTTPClient: fcommon.GetHTTPClient(),
PublicKey: []byte(autoupdate.PackagePublicKey),
}
}
Expand Down
Loading
Loading