Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Oct 26, 2024
1 parent 1d58562 commit 2fd978c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions fronted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2fd978c

Please sign in to comment.