mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-26 15:06:36 +08:00
HTTP防火墙在启动时检测是否可用
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var currentFirewall FirewallInterface
|
var currentFirewall FirewallInterface
|
||||||
@@ -41,7 +42,14 @@ func Firewall() FirewallInterface {
|
|||||||
endpoint, _ := os.LookupEnv("EDGE_HTTP_FIREWALL_ENDPOINT")
|
endpoint, _ := os.LookupEnv("EDGE_HTTP_FIREWALL_ENDPOINT")
|
||||||
if len(endpoint) > 0 {
|
if len(endpoint) > 0 {
|
||||||
var httpFirewall = NewHTTPFirewall(endpoint)
|
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
|
return httpFirewall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user