feat: re introduce IpWhitelist middleware as deprecated
This commit is contained in:
parent
3bbc560283
commit
ff7966f9cd
38 changed files with 1314 additions and 200 deletions
|
@ -248,6 +248,30 @@ func (s *TCPSuite) TestMiddlewareAllowList() {
|
|||
assert.Contains(s.T(), out, "whoami-b")
|
||||
}
|
||||
|
||||
func (s *TCPSuite) TestMiddlewareWhiteList() {
|
||||
file := s.adaptFile("fixtures/tcp/ip-whitelist.toml", struct {
|
||||
WhoamiA string
|
||||
WhoamiB string
|
||||
}{
|
||||
WhoamiA: s.getComposeServiceIP("whoami-a") + ":8080",
|
||||
WhoamiB: s.getComposeServiceIP("whoami-b") + ":8080",
|
||||
})
|
||||
|
||||
s.traefikCmd(withConfigFile(file))
|
||||
|
||||
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", 5*time.Second, try.StatusCodeIs(http.StatusOK), try.BodyContains("HostSNI(`whoami-a.test`)"))
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
// Traefik not passes through, ipWhiteList closes connection
|
||||
_, err = guessWhoTLSPassthrough("127.0.0.1:8093", "whoami-a.test")
|
||||
assert.ErrorIs(s.T(), err, io.EOF)
|
||||
|
||||
// Traefik passes through, termination handled by whoami-b
|
||||
out, err := guessWhoTLSPassthrough("127.0.0.1:8093", "whoami-b.test")
|
||||
require.NoError(s.T(), err)
|
||||
assert.Contains(s.T(), out, "whoami-b")
|
||||
}
|
||||
|
||||
func (s *TCPSuite) TestWRR() {
|
||||
file := s.adaptFile("fixtures/tcp/wrr.toml", struct {
|
||||
WhoamiB string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue