mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 23:20:25 +08:00
HTTP防火墙在启动时检测是否可用
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user