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

Remove Pro client #1371

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
25 changes: 0 additions & 25 deletions client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import (
"github.com/getlantern/proxy/v3/filters"

"github.com/getlantern/flashlight/v7/chained"
"github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/flashlight/v7/ops"
"github.com/getlantern/flashlight/v7/pro"
)

func (client *Client) handle(conn net.Conn) error {
Expand Down Expand Up @@ -62,11 +60,6 @@ func (client *Client) filter(cs *filters.ConnectionState, req *http.Request, nex
req.URL.Scheme = "http"
req.URL.Host = req.Host

if common.Platform == "android" && req.URL != nil && req.URL.Host == "localhost" &&
strings.HasPrefix(req.URL.Path, "/pro/") {
return client.interceptProRequest(cs, req)
}

op, ok := client.opsMap.get(cs.Downstream())
if ok {
op.UserAgent(req.Header.Get("User-Agent")).OriginFromRequest(req)
Expand Down Expand Up @@ -154,24 +147,6 @@ func (client *Client) isHTTPProxyPort(r *http.Request) bool {
return false
}

// interceptProRequest specifically looks for and properly handles pro server
// requests (similar to desktop's APIHandler)
func (client *Client) interceptProRequest(cs *filters.ConnectionState, r *http.Request) (*http.Response, *filters.ConnectionState, error) {
log.Debugf("Intercepting request to pro server: %v", r.URL.Path)
r.URL.Path = r.URL.Path[4:]
pro.PrepareProRequest(r, client.user)
r.Header.Del("Origin")
resp, err := pro.GetHTTPClient().Do(r)
if err != nil {
log.Errorf("Error intercepting request to pro server: %v", err)
resp = &http.Response{
StatusCode: http.StatusInternalServerError,
Close: true,
}
}
return filters.ShortCircuit(cs, r, resp)
}

func (client *Client) easyblock(cs *filters.ConnectionState, req *http.Request) (*http.Response, *filters.ConnectionState, error) {
log.Debugf("Blocking %v on %v", req.URL, req.Host)
client.statsTracker.IncAdsBlocked()
Expand Down
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/getlantern/flashlight/v7

go 1.21
go 1.22.0

replace github.com/elazarl/goproxy => github.com/getlantern/goproxy v0.0.0-20220805074304-4a43a9ed4ec6

Expand Down Expand Up @@ -30,8 +30,6 @@ require (
github.com/anacrolix/dht/v2 v2.20.0
github.com/blang/semver v3.5.1+incompatible
github.com/dustin/go-humanize v1.0.1
github.com/eycorsican/go-tun2socks v1.16.12-0.20201107203946-301549c435ff
github.com/fsnotify/fsnotify v1.6.0
github.com/getlantern/broflake v0.0.0-20231117182649-7d46643a6f87
github.com/getlantern/bufconn v0.0.0-20210901195825-fd7c0267b493
github.com/getlantern/cmux/v2 v2.0.0-20230301223233-dac79088a4c0
Expand All @@ -41,7 +39,7 @@ require (
github.com/getlantern/dnsgrab v0.0.0-20211216020425-5d5e155a01a8
github.com/getlantern/domains v0.0.0-20220311111720-94f59a903271
github.com/getlantern/ema v0.0.0-20190620044903-5943d28f40e4
github.com/getlantern/errors v1.0.3
github.com/getlantern/errors v1.0.5-0.20240410211607-f268a297d5d1
github.com/getlantern/event v0.0.0-20210901195647-a7e3145142e6
github.com/getlantern/eventual v1.0.0
github.com/getlantern/eventual/v2 v2.0.2
Expand Down Expand Up @@ -72,7 +70,6 @@ require (
github.com/getlantern/replica v0.14.3
github.com/getlantern/rot13 v0.0.0-20220822172233-370767b2f782
github.com/getlantern/rotator v0.0.0-20160829164113-013d4f8e36a2
github.com/getlantern/safechannels v0.0.0-20201218194342-b4e5383e9627
github.com/getlantern/shortcut v0.0.0-20211026183428-bf59a137fdec
github.com/getlantern/timezone v0.0.0-20210901200113-3f9de9d360c9
github.com/getlantern/tinywss v0.0.0-20211216020538-c10008a7d461
Expand All @@ -86,7 +83,6 @@ require (
github.com/getlantern/yaml v0.0.0-20190801163808-0c9bb1ebf426
github.com/getsentry/sentry-go v0.20.0
github.com/golang/protobuf v1.5.3
github.com/google/gopacket v1.1.19
github.com/hashicorp/golang-lru v0.5.4
github.com/jaffee/commandeer v0.6.0
github.com/keighl/mandrill v0.0.0-20170605120353-1775dd4b3b41
Expand All @@ -113,6 +109,8 @@ require (
howett.net/plist v1.0.0
)

require github.com/fsnotify/fsnotify v1.6.0 // indirect

require (
git.torproject.org/pluggable-transports/goptlib.git v1.2.0 // indirect
github.com/dchest/siphash v1.2.3 // indirect
Expand Down
12 changes: 4 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFB
github.com/getlantern/errors v1.0.1/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
github.com/getlantern/errors v1.0.3 h1:Ne4Ycj7NI1BtSyAfVeAT/DNoxz7/S2BUc3L2Ht1YSHE=
github.com/getlantern/errors v1.0.3/go.mod h1:m8C7H1qmouvsGpwQqk/6NUpIVMpfzUPn608aBZDYV04=
github.com/getlantern/errors v1.0.5-0.20240410211410-efcb55d54ffb h1:I8oXS6xtVXtxq5RBpAkxV8tyrS6dq5akyBZsnkzozns=
github.com/getlantern/errors v1.0.5-0.20240410211410-efcb55d54ffb/go.mod h1:L1h+WK2Enz9MzoHsyGpdtQlwXe7U/ANbSM4rEbAl3N8=
github.com/getlantern/errors v1.0.5-0.20240410211607-f268a297d5d1 h1:06/WReVGjGazEKDQcT/OADWkhr/EQY3Q8TdtLCZfu5E=
github.com/getlantern/errors v1.0.5-0.20240410211607-f268a297d5d1/go.mod h1:L1h+WK2Enz9MzoHsyGpdtQlwXe7U/ANbSM4rEbAl3N8=
github.com/getlantern/event v0.0.0-20210901195647-a7e3145142e6 h1:sjFsoQHJqzDiwgbOLHnG/zYIpN1Sbmv/7gk1ie/KkHg=
github.com/getlantern/event v0.0.0-20210901195647-a7e3145142e6/go.mod h1:iToZ3dqm/iFxRHPHUHUrF1JZtg0e06ZSXD1BuiGoUaY=
github.com/getlantern/eventual v0.0.0-20180125201821-84b02499361b/go.mod h1:O8T3zFEcY6+LRXFcVV4q8mEu2tDIixG8edC84DfswBc=
Expand All @@ -266,8 +270,6 @@ github.com/getlantern/geolookup v0.0.0-20230327091034-aebe73c6eef4 h1:Ju9l1RretV
github.com/getlantern/geolookup v0.0.0-20230327091034-aebe73c6eef4/go.mod h1:4UNvIsawdB8WclVxqYv46Oe1zzWJ8wMhUO+q6tUzATo=
github.com/getlantern/go-socks5 v0.0.0-20171114193258-79d4dd3e2db5 h1:RBKofGGMt2k6eGBwX8mky9qunjL+KnAp9JdzXjiRkRw=
github.com/getlantern/go-socks5 v0.0.0-20171114193258-79d4dd3e2db5/go.mod h1:kGHRXch95rnGLHjER/GhhFiHvfnqNz7KqWD9kGfATHY=
github.com/getlantern/go-tun2socks v1.16.12-0.20201218023150-b68f09e5ae93 h1:CFLw2b6vgOmpxsRWRiTd46tiR6YKg2crIuTu4cINYcY=
github.com/getlantern/go-tun2socks v1.16.12-0.20201218023150-b68f09e5ae93/go.mod h1:wgB2BFT8ZaPKyKOQ/5dljMG/YIow+AIXyq4KBwJ5sGQ=
github.com/getlantern/golog v0.0.0-20190809085441-26e09e6dd330/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
github.com/getlantern/golog v0.0.0-20200929154820-62107891371a/go.mod h1:ZyIjgH/1wTCl+B+7yH1DqrWp6MPJqESmwmEQ89ZfhvA=
Expand Down Expand Up @@ -372,8 +374,6 @@ github.com/getlantern/rot13 v0.0.0-20220822172233-370767b2f782 h1:A1+qM0Dqm0no8A
github.com/getlantern/rot13 v0.0.0-20220822172233-370767b2f782/go.mod h1:O0dNqH9hbXlOa9OpVdbACmTBfDPD+ENjbY0cPkzBd9g=
github.com/getlantern/rotator v0.0.0-20160829164113-013d4f8e36a2 h1:smFR/kESUKlcdyatoOO3HngBzzrUU6S0LRw2vCBYQPg=
github.com/getlantern/rotator v0.0.0-20160829164113-013d4f8e36a2/go.mod h1:Ap+QTDJeA24+0jjPHReq/LyP3ugEEDYvncluEgsm60A=
github.com/getlantern/safechannels v0.0.0-20201218194342-b4e5383e9627 h1:eYXtxjRyiP9f1rMvbnyT4DBWFEiIPY3zzMA5KqVshyc=
github.com/getlantern/safechannels v0.0.0-20201218194342-b4e5383e9627/go.mod h1:QJUudepmTj/KQXnReV6DZSJY/xO05fnfcZf3t8zkNLg=
github.com/getlantern/shortcut v0.0.0-20211026183428-bf59a137fdec h1:8TfjIMydnhBs4edmXu2Nz1f2P0QOcXfol2rR1cxfrSs=
github.com/getlantern/shortcut v0.0.0-20211026183428-bf59a137fdec/go.mod h1:3VQ6qvEBehqDBNbEKfNtSjK6MR5ydOdjMPgKjKay7vo=
github.com/getlantern/telemetry v0.0.0-20230523155019-be7c1d8cd8cb h1:6XZ3Q4oD6A1Tjq6QLgzzQrdQ8FvulzW16HhNQOSECAM=
Expand Down Expand Up @@ -778,7 +778,6 @@ github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac/go.mod h1
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 h1:TG/diQgUe0pntT/2D9tmUCz4VNwm9MfrtPr0SU2qSX8=
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand Down Expand Up @@ -934,7 +933,6 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -960,7 +958,6 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down Expand Up @@ -1084,7 +1081,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
Expand Down
189 changes: 0 additions & 189 deletions ios/client_test.go

This file was deleted.

Loading
Loading