支持设置HTTP防火墙

This commit is contained in:
GoEdgeLab
2024-03-07 19:32:02 +08:00
parent 6380f6beaa
commit 216b5c8674
2 changed files with 161 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/events"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"os"
"runtime"
"sync"
)
@@ -35,6 +36,16 @@ func Firewall() FirewallInterface {
return currentFirewall
}
// http firewall
{
endpoint, _ := os.LookupEnv("EDGE_HTTP_FIREWALL_ENDPOINT")
if len(endpoint) > 0 {
var httpFirewall = NewHTTPFirewall(endpoint)
currentFirewall = httpFirewall
return httpFirewall
}
}
// nftables
if runtime.GOOS == "linux" {
nftables, err := NewNFTablesFirewall()