From 2fd978c3c13b466e07b47dae3c2a9a4993ffb72a Mon Sep 17 00:00:00 2001 From: Adam Fisk Date: Sat, 26 Oct 2024 08:17:07 -0600 Subject: [PATCH] Minor tweaks --- context.go | 2 ++ fronted_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/context.go b/context.go index 86432a1..556ea43 100644 --- a/context.go +++ b/context.go @@ -90,6 +90,8 @@ func (fctx *FrontingContext) NewFronted(timeout time.Duration) (http.RoundTrippe if !ok { log.Errorf("No DirectHttpClient available within %v for context %s", timeout, fctx.name) return nil, false + } else { + log.Debugf("DirectHttpClient available for context %s", fctx.name) } return instance.(http.RoundTripper), true } diff --git a/fronted_test.go b/fronted_test.go index 3139fe0..f80cdf6 100644 --- a/fronted_test.go +++ b/fronted_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestDirectDomainFronting(t *testing.T) { +func TestDirectDomainFrontingWithoutSNIConfig(t *testing.T) { dir, err := os.MkdirTemp("", "direct_test") require.NoError(t, err, "Unable to create temp dir") defer os.RemoveAll(dir) @@ -107,14 +107,14 @@ func doTestDomainFronting(t *testing.T, cacheFile string, expectedMasqueradesAtE require.True(t, ok) d := instance.(*fronted) - // Check the number of masquerades at the end, waiting up to 30 seconds until we get the right number + // Check the number of masquerades at the end, waiting until we get the right number masqueradesAtEnd := 0 - for i := 0; i < 100; i++ { + for i := 0; i < 1000; i++ { masqueradesAtEnd = len(d.masquerades) if masqueradesAtEnd == expectedMasqueradesAtEnd { break } - time.Sleep(300 * time.Millisecond) + time.Sleep(30 * time.Millisecond) } require.GreaterOrEqual(t, masqueradesAtEnd, expectedMasqueradesAtEnd) return masqueradesAtEnd