This commit is contained in:
GoEdgeLab
2024-07-27 15:42:50 +08:00
parent d511145bc5
commit c19be78e0d
524 changed files with 1817 additions and 1346 deletions
+5 -4
View File
@@ -8,6 +8,11 @@ import (
"encoding/json"
"errors"
"fmt"
"net"
"strings"
"sync"
"time"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
@@ -20,10 +25,6 @@ import (
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/types"
stringutil "github.com/iwind/TeaGo/utils/string"
"net"
"strings"
"sync"
"time"
)
var SharedDDoSProtectionManager = NewDDoSProtectionManager()
+4 -3
View File
@@ -3,13 +3,14 @@
package firewalls
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/events"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"os"
"runtime"
"sync"
"time"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/events"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
)
var currentFirewall FirewallInterface
+3 -2
View File
@@ -1,12 +1,13 @@
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package firewalls
import (
"github.com/iwind/TeaGo/types"
"strings"
"sync"
"time"
"github.com/iwind/TeaGo/types"
)
type BaseFirewall struct {
+3 -2
View File
@@ -4,13 +4,14 @@ package firewalls
import (
"fmt"
"strings"
"time"
"github.com/TeaOSLab/EdgeNode/internal/conns"
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"github.com/iwind/TeaGo/types"
"strings"
"time"
)
type firewalldCmd struct {
+4 -3
View File
@@ -1,4 +1,4 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package firewalls
@@ -6,11 +6,12 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
"io"
"net/http"
"net/url"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
)
type HTTPFirewall struct {
+6 -5
View File
@@ -6,6 +6,12 @@ package firewalls
import (
"errors"
"fmt"
"net"
"regexp"
"runtime"
"strings"
"time"
"github.com/TeaOSLab/EdgeCommon/pkg/iputils"
"github.com/TeaOSLab/EdgeNode/internal/conns"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
@@ -16,11 +22,6 @@ import (
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"github.com/google/nftables/expr"
"github.com/iwind/TeaGo/types"
"net"
"regexp"
"runtime"
"strings"
"time"
)
// check nft status, if being enabled we load it automatically
+1
View File
@@ -6,6 +6,7 @@ package nftables
import (
"bytes"
"errors"
nft "github.com/google/nftables"
"github.com/google/nftables/expr"
)
+2 -1
View File
@@ -4,9 +4,10 @@
package nftables_test
import (
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"net"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
)
func getIPv4Chain(t *testing.T) *nftables.Chain {
+1
View File
@@ -5,6 +5,7 @@ package nftables
import (
"errors"
nft "github.com/google/nftables"
"github.com/iwind/TeaGo/types"
)
+2 -1
View File
@@ -5,9 +5,10 @@
package nftables_test
import (
"testing"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
"testing"
)
func TestConn_Test(t *testing.T) {
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package nftables
@@ -1,14 +1,15 @@
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package nftables_test
import (
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
"net"
"testing"
"time"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
)
func TestExpiration_Add(t *testing.T) {
+5 -4
View File
@@ -1,10 +1,14 @@
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
//go:build linux
package nftables
import (
"fmt"
"os"
"runtime"
"time"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/events"
@@ -12,9 +16,6 @@ import (
executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"github.com/iwind/TeaGo/logs"
"os"
"runtime"
"time"
)
func init() {
+3 -2
View File
@@ -5,11 +5,12 @@ package nftables
import (
"errors"
"github.com/TeaOSLab/EdgeNode/internal/utils"
nft "github.com/google/nftables"
"net"
"strings"
"time"
"github.com/TeaOSLab/EdgeNode/internal/utils"
nft "github.com/google/nftables"
)
const MaxSetNameLength = 15
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
//go:build linux && !plus
package nftables
+4 -3
View File
@@ -5,12 +5,13 @@ package nftables_test
import (
"errors"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"github.com/iwind/TeaGo/types"
"github.com/mdlayher/netlink"
"net"
"testing"
"time"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"github.com/iwind/TeaGo/types"
"github.com/mdlayher/netlink"
)
func getIPv4Set(t *testing.T) *nftables.Set {
+2 -1
View File
@@ -5,9 +5,10 @@ package nftables
import (
"errors"
"strings"
nft "github.com/google/nftables"
"github.com/iwind/TeaGo/types"
"strings"
)
type Table struct {
+2 -1
View File
@@ -4,8 +4,9 @@
package nftables_test
import (
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/firewalls/nftables"
)
func getIPv4Table(t *testing.T) *nftables.Table {
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 GoEdge goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package firewalls