Skip to content

Commit

Permalink
Revert module changes
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Nov 25, 2024
1 parent d434903 commit 670b8cf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
51 changes: 33 additions & 18 deletions email/email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import (
"github.com/stretchr/testify/assert"

"github.com/getlantern/flashlight/v7/config"
"github.com/getlantern/flashlight/v7/embeddedconfig"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/fronted"
"github.com/getlantern/golog"
"github.com/getlantern/keyman"
"github.com/getlantern/yaml"
)

Expand Down Expand Up @@ -62,22 +60,7 @@ func TestSubmitIssue(t *testing.T) {
// test that domain-fronting is working, you can block mandrillapp.com, for
// example by setting its address to 0.0.0.0 in /etc/hosts.
if false {
cfg := &config.Global{}
err := yaml.Unmarshal(embeddedconfig.Global, cfg)
if !assert.NoError(t, err) {
return
}

certs := make([]string, 0, len(cfg.TrustedCAs))
for _, ca := range cfg.TrustedCAs {
certs = append(certs, ca.Cert)
}
pool, err := keyman.PoolContainingCerts(certs...)
if !assert.NoError(t, err) {
return
}

fronted.Configure(pool, cfg.Client.FrontedProviders(), config.DefaultFrontedProviderID, filepath.Join(tempConfigDir, "masquerade_cache"))
fronted := newFronted()
SetHTTPClient(proxied.DirectThenFrontedClient(5 * time.Second))
defer SetHTTPClient(&http.Client{})

Expand All @@ -89,3 +72,35 @@ func TestSubmitIssue(t *testing.T) {
assert.NoError(t, sendTemplate(context.Background(), msg), "Should be able to send email")
}
}

func newFronted() fronted.Fronted {
// Init domain-fronting
global, err := os.ReadFile("../embeddedconfig/global.yaml")
if err != nil {
log.Errorf("Unable to load embedded global config: %v", err)
os.Exit(1)
}
cfg := config.NewGlobal()
err = yaml.Unmarshal(global, cfg)
if err != nil {
log.Errorf("Unable to unmarshal embedded global config: %v", err)
os.Exit(1)
}

certs, err := cfg.TrustedCACerts()
if err != nil {
log.Errorf("Unable to read trusted certs: %v", err)
}

tempConfigDir, err := os.MkdirTemp("", "issue_test")
if err != nil {
log.Errorf("Unable to create temp config dir: %v", err)
os.Exit(1)
}
defer os.RemoveAll(tempConfigDir)
fronted, err := fronted.NewFronter(certs, cfg.Client.FrontedProviders(), config.DefaultFrontedProviderID, filepath.Join(tempConfigDir, "masquerade_cache"))
if err != nil {
log.Errorf("Unable to configure fronted: %v", err)
}
return fronted
}
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ replace github.com/elazarl/goproxy => github.com/getlantern/goproxy v0.0.0-20220

replace github.com/keighl/mandrill => github.com/getlantern/mandrill v0.0.0-20221004112352-e7c04248adcb

//replace github.com/getlantern/yinbi-server => ../yinbi-server

//replace github.com/getlantern/mandrill => /home/soltzen/dev/soltzen/mandrill

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

//replace github.com/getlantern/lantern-server => ../lantern-server
//replace github.com/getlantern/fronted => ../fronted

replace github.com/eycorsican/go-tun2socks => github.com/getlantern/go-tun2socks v1.16.12-0.20201218023150-b68f09e5ae93

Expand Down Expand Up @@ -79,7 +75,6 @@ require (
github.com/getlantern/uuid v1.2.0
github.com/getlantern/waitforserver v1.0.1
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/hashicorp/golang-lru v0.5.4
github.com/jaffee/commandeer v0.6.0
Expand Down Expand Up @@ -120,6 +115,7 @@ require (
github.com/getlantern/algeneva v0.0.0-20240222191137-2b4e88234f59 // indirect
github.com/getlantern/lampshade v0.0.0-20201109225444-b06082e15f3a // indirect
github.com/getlantern/withtimeout v0.0.0-20160829163843-511f017cd913 // indirect
github.com/getsentry/sentry-go v0.20.0 // indirect
github.com/go-llsqlite/crawshaw v0.5.1 // indirect
github.com/tetratelabs/wazero v1.7.1 // indirect
github.com/vishvananda/netns v0.0.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtA
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
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-20241120203013-eedcd71609d2 h1:h3TZ7ye/1fqOLqfwTho4iRSEQqTMKVJIsOF+5XNyhus=
github.com/getlantern/fronted v0.0.0-20241120203013-eedcd71609d2/go.mod h1:NfZDG8pmTL3wvo/s/sflpJFsgIL7etelgwzDRtO4HIM=
github.com/getlantern/geo v0.0.0-20240108161311-50692a1b69a9 h1:mSg57/+t59Q08AqArlhW+3N1AVPn5ox0dTOYonRps6w=
github.com/getlantern/geo v0.0.0-20240108161311-50692a1b69a9/go.mod h1:RjQ0krF8NTCc5xo2Q1995/vZBnYg33h8svn15do7dLg=
github.com/getlantern/go-socks5 v0.0.0-20171114193258-79d4dd3e2db5 h1:RBKofGGMt2k6eGBwX8mky9qunjL+KnAp9JdzXjiRkRw=
Expand Down

0 comments on commit 670b8cf

Please sign in to comment.