From 94aefacba4a7708017809d08ecf361a4b5721fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 8 Mar 2024 10:21:59 +0800 Subject: [PATCH] =?UTF-8?q?HTTP=E9=98=B2=E7=81=AB=E5=A2=99=E5=9C=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E6=A3=80=E6=B5=8B=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/firewalls/firewall.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/firewalls/firewall.go b/internal/firewalls/firewall.go index a515255..3dc7876 100644 --- a/internal/firewalls/firewall.go +++ b/internal/firewalls/firewall.go @@ -9,6 +9,7 @@ import ( "os" "runtime" "sync" + "time" ) var currentFirewall FirewallInterface @@ -41,7 +42,14 @@ func Firewall() FirewallInterface { endpoint, _ := os.LookupEnv("EDGE_HTTP_FIREWALL_ENDPOINT") if len(endpoint) > 0 { var httpFirewall = NewHTTPFirewall(endpoint) - currentFirewall = httpFirewall + for i := 0; i < 10; i++ { + if httpFirewall.IsReady() { + currentFirewall = httpFirewall + remotelogs.Println("FIREWALL", "using http firewall '"+endpoint+"'") + break + } + time.Sleep(1 * time.Second) + } return httpFirewall } }