Compare commits

..

2 Commits

Author SHA1 Message Date
刘祥超
6255573e2e 版本号修改为1.3.8 2024-04-30 19:07:25 +08:00
刘祥超
26bcb3b590 可以在集群设置中修改节点最大并发读/写数 2024-04-30 19:07:17 +08:00
391 changed files with 768 additions and 2380 deletions

View File

@@ -53,5 +53,11 @@
* [API节点](https://github.com/TeaOSLab/EdgeAPI)
* [管理平台](https://github.com/TeaOSLab/EdgeAdmin)
## 联系我们
有什么问题和建议都可以加入 [Telegram群](https://t.me/+5kVCMGxQhZxiODY9)
## 企业版
* [GoEdge企业版](https://goedge.cn/commercial) - 功能更强大的CDN系统
## 感谢
* 感谢 [Gitee](https://gitee.com/) 提供国内源代码托管平台

View File

@@ -9,11 +9,8 @@ import (
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
"github.com/TeaOSLab/EdgeAdmin/internal/gen"
"github.com/TeaOSLab/EdgeAdmin/internal/nodes"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/updates/updateutils"
_ "github.com/TeaOSLab/EdgeCommon/pkg/langs/messages"
"github.com/iwind/TeaGo/Tea"
_ "github.com/iwind/TeaGo/bootstrap"
@@ -159,9 +156,6 @@ func main() {
for range ticker.C {
if manager.IsDownloading() {
if !isStarted {
if len(manager.NewVersion()) == 0 {
continue
}
log.Println("start downloading v" + manager.NewVersion() + " ...")
isStarted = true
}
@@ -182,18 +176,6 @@ func main() {
log.Println("upgrade failed: " + err.Error())
return
}
// try to exec local 'edge-api upgrade'
rpcClient, err := rpc.SharedRPC()
if err == nil {
exePath, ok := updateutils.CheckLocalAPINode(rpcClient, rpcClient.Context(0))
if ok && len(exePath) > 0 {
log.Println("upgrading database ...")
var cmd = executils.NewCmd(exePath, "upgrade")
_ = cmd.Run()
}
}
log.Println("finished!")
log.Println("restarting ...")
app.RunRestart()

View File

@@ -1,7 +1,7 @@
FROM --platform=linux/amd64 alpine:latest
LABEL maintainer="goedge.cdn@gmail.com"
ENV TZ "Asia/Shanghai"
ENV VERSION 1.3.8
ENV VERSION 1.3.7
ENV ROOT_DIR /usr/local/goedge
ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip

2
go.mod
View File

@@ -14,7 +14,6 @@ require (
github.com/quic-go/quic-go v0.42.0
github.com/shirou/gopsutil/v3 v3.22.5
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/tdewolff/minify/v2 v2.20.20
github.com/tealeg/xlsx/v3 v3.2.3
github.com/xlzd/gotp v0.1.0
golang.org/x/crypto v0.22.0
@@ -38,7 +37,6 @@ require (
github.com/quic-go/qpack v0.4.0 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa // indirect
github.com/tdewolff/parse/v2 v2.7.13 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect

13
go.sum
View File

@@ -28,6 +28,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f h1:f00RU+zOX+B3rLAmMMkzHUF2h1z4DeYR9tTCvEq2REY=
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf h1:WA9qgiynESu/DDTnLH6npRI5AK6UL9qwJ2YZ5qhJX5E=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9 h1:lqSd+OeAMzPlejoVtsmHJEeQ6/MWXCr+Ws2eX9/Rewg=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 h1:VWGsCqTzObdlbf7UUE3oceIpcEKi4C/YBUszQXk118A=
@@ -70,17 +72,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tdewolff/minify/v2 v2.20.20 h1:vhULb+VsW2twkplgsawAoUY957efb+EdiZ7zu5fUhhk=
github.com/tdewolff/minify/v2 v2.20.20/go.mod h1:GYaLXFpIIwsX99apQHXfGdISUdlA98wmaoWxjT9C37k=
github.com/tdewolff/parse/v2 v2.7.13 h1:iSiwOUkCYLNfapHoqdLcqZVgvQ0jrsao8YYKP/UJYTI=
github.com/tdewolff/parse/v2 v2.7.13/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA=
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03u/dMQK9g+Iw9ewps4mCl1nB8Sscbo=
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8=
github.com/tealeg/xlsx/v3 v3.2.3 h1:MXnVh+9Y8cUglowItTy2HL3Kv6z+q/0aNjeKuTsVqZQ=
github.com/tealeg/xlsx/v3 v3.2.3/go.mod h1:0hGmAEoZ48SS1ZAE6eqZJkJVXgOMY+8a33vjXa8S8HA=
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 h1:YyPWX3jLOtYKulBR6AScGIs74lLrJcgeKRwcbAuQOG4=
github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119/go.mod h1:/nuTSlK+okRfR/vnIPqR89fFKonnWPiZymN5ydRJkX8=
github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=
github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
@@ -91,6 +88,8 @@ golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=

View File

@@ -1,51 +0,0 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
package configs
import (
"fmt"
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/dbs"
"gopkg.in/yaml.v3"
"net/url"
"os"
)
type SimpleDBConfig struct {
User string `yaml:"user"`
Password string `yaml:"password"`
Database string `yaml:"database"`
Host string `yaml:"host"`
BoolFields []string `yaml:"boolFields,omitempty"`
}
func (this *SimpleDBConfig) GenerateOldConfig(targetFile string) error {
var dbConfig = &dbs.DBConfig{
Driver: "mysql",
Dsn: url.QueryEscape(this.User) + ":" + url.QueryEscape(this.Password) + "@tcp(" + this.Host + ")/" + url.PathEscape(this.Database) + "?charset=utf8mb4&timeout=30s&multiStatements=true",
Prefix: "edge",
}
dbConfig.Models.Package = "internal/db/models"
var config = &dbs.Config{
DBs: map[string]*dbs.DBConfig{
Tea.Env: dbConfig,
},
}
config.Default.DB = Tea.Env
config.Fields = map[string][]string{
"bool": this.BoolFields,
}
oldConfigYAML, encodeErr := yaml.Marshal(config)
if encodeErr != nil {
return encodeErr
}
err := os.WriteFile(targetFile, oldConfigYAML, 0666)
if err != nil {
return fmt.Errorf("create database config file failed: %w", err)
}
return nil
}

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
package teaconst

View File

@@ -1,15 +1,17 @@
package teaconst
const (
Version = "1.3.9"
Version = "1.3.8"
APINodeVersion = "1.3.9"
APINodeVersion = "1.3.8"
ProductName = "Edge Admin"
ProcessName = "edge-admin"
ProductName = "Edge Admin"
ProcessName = "edge-admin"
ProductNameZH = "Edge"
Role = "admin"
EncryptKey = "8f983f4d69b83aaa0d74b21a212f6967"
EncryptMethod = "aes-256-cfb"
CookieSID = "geadsid"

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
package teaconst

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package teaconst

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package gen
@@ -39,7 +39,7 @@ func generateComponentsJSFile() error {
} else {
webRoot = Tea.Root + "/web/public/js/components/"
}
var f = files.NewFile(webRoot)
f := files.NewFile(webRoot)
f.Range(func(file *files.File) {
if !file.IsFile() {
@@ -53,7 +53,6 @@ func generateComponentsJSFile() error {
logs.Error(err)
return
}
buffer.Write(data)
buffer.Write([]byte{'\n', '\n'})
})

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package gen

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package goman

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package goman

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package goman

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build !plus
package nodes

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package nodes
@@ -73,7 +73,7 @@ func (this *SessionManager) Read(sid string) map[string]string {
func (this *SessionManager) WriteItem(sid string, key string, value string) bool {
// 删除缓存
defer ttlcache.DefaultCache.Delete("SESSION@" + sid)
defer ttlcache.DefaultCache.Delete( "SESSION@" + sid)
// 忽略OTP
if strings.HasSuffix(sid, "_otp") {
@@ -99,7 +99,7 @@ func (this *SessionManager) WriteItem(sid string, key string, value string) bool
func (this *SessionManager) Delete(sid string) bool {
// 删除缓存
defer ttlcache.DefaultCache.Delete("SESSION@" + sid)
defer ttlcache.DefaultCache.Delete( "SESSION@" + sid)
// 忽略OTP
if strings.HasSuffix(sid, "_otp") {

View File

@@ -385,10 +385,6 @@ func (this *RPCClient) LoginSessionRPC() pb.LoginSessionServiceClient {
return pb.NewLoginSessionServiceClient(this.pickConn())
}
func (this *RPCClient) LoginTicketRPC() pb.LoginTicketServiceClient {
return pb.NewLoginTicketServiceClient(this.pickConn())
}
func (this *RPCClient) NodeTaskRPC() pb.NodeTaskServiceClient {
return pb.NewNodeTaskServiceClient(this.pickConn())
}

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package tasks

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package apinodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package apinodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package apinodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package apinodeutils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package apinodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dateutils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package executils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package executils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package utils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package utils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
package nodelogutils

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package numberutils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package sizes

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package sizes_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package utils_test

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package accesskeys

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package accesskeys

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package cluster

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package cluster

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package cluster

View File

@@ -48,7 +48,6 @@ func init() {
Get("/logs", new(node.LogsAction)).
Post("/start", new(node.StartAction)).
Post("/stop", new(node.StopAction)).
Post("/uninstall", new(node.UninstallAction)).
Post("/up", new(node.UpAction)).
Post("/updateIsOn", new(node.UpdateIsOnAction)).
Get("/detail", new(node.DetailAction)).

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package nodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build !plus
package nodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package cache

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ddosProtection

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ddosProtection

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dns

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ssh

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ssh

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package system

View File

@@ -1,32 +0,0 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
package node
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type UninstallAction struct {
actionutils.ParentAction
}
func (this *UninstallAction) RunPost(params struct {
NodeId int64
}) {
resp, err := this.RPC().NodeRPC().UninstallNode(this.AdminContext(), &pb.UninstallNodeRequest{NodeId: params.NodeId})
if err != nil {
this.ErrorPage(err)
return
}
// 创建日志
defer this.CreateLogInfo(codes.Node_LogUninstallNodeRemotely, params.NodeId)
if resp.IsOk {
this.Success()
}
this.Fail("执行失败:" + resp.Error)
}

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
package node

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ddosProtection

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ddosProtection
@@ -34,7 +34,7 @@ func (this *StatusAction) RunPost(params struct {
}) {
results, err := nodeutils.SendMessageToCluster(this.AdminContext(), params.ClusterId, messageconfigs.MessageCodeCheckLocalFirewall, &messageconfigs.CheckLocalFirewallMessage{
Name: "nftables",
}, 10, false)
}, 10)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dns

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package globalServerConfig
@@ -110,7 +110,6 @@ func (this *IndexAction) RunPost(params struct {
HttpAllNodeIPShowPage bool
HttpAllEnableServerAddrVariable bool
HttpAllRequestOriginsWithEncodings bool
HttpAllXFFMaxAddresses int
HttpAllDomainAuditingIsOn bool
HttpAllDomainAuditingPrompt string
@@ -220,7 +219,6 @@ func (this *IndexAction) RunPost(params struct {
config.HTTPAll.LnRequestSchedulingMethod = params.HttpAllLnRequestSchedulingMethod
config.HTTPAll.EnableServerAddrVariable = params.HttpAllEnableServerAddrVariable
config.HTTPAll.RequestOriginsWithEncodings = params.HttpAllRequestOriginsWithEncodings
config.HTTPAll.XFFMaxAddresses = params.HttpAllXFFMaxAddresses
// 访问日志
config.HTTPAccessLog.IsOn = params.HttpAccessLogIsOn

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package health

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package metrics

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package metrics

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package metrics

View File

@@ -26,7 +26,7 @@ func (this *StatusAction) RunPost(params struct {
Must *actions.Must
}) {
results, err := nodeutils.SendMessageToCluster(this.AdminContext(), params.ClusterId, messageconfigs.MessageCodeCheckSystemdService, &messageconfigs.CheckSystemdServiceMessage{}, 10, false)
results, err := nodeutils.SendMessageToCluster(this.AdminContext(), params.ClusterId, messageconfigs.MessageCodeCheckSystemdService, &messageconfigs.CheckSystemdServiceMessage{}, 10)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package cluster

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build !plus
package clusterutils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package clusterutils

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package grants

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package logs

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package logs

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package logs

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package logs

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package logs

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package clusters

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package clusters

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package clusters

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package regions

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package regions

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package clusters

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dashboardutils

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dashboard
@@ -92,16 +92,13 @@ func (this *IndexAction) RunPost(params struct{}) {
"diskUsageWarning": diskUsageWarning,
}
// 今日流量和独立IP数
var todayTrafficBytes int64
var todayCountIPs int64
// 今日流量
todayTrafficBytes := int64(0)
if len(resp.DailyTrafficStats) > 0 {
var lastDailyTrafficStat = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1]
todayTrafficBytes = lastDailyTrafficStat.Bytes
todayCountIPs = lastDailyTrafficStat.CountIPs
todayTrafficBytes = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1].Bytes
}
var todayTrafficString = numberutils.FormatBytes(todayTrafficBytes)
var result = regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
todayTrafficString := numberutils.FormatBytes(todayTrafficBytes)
result := regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
if len(result) > 2 {
this.Data["todayTraffic"] = result[1]
this.Data["todayTrafficUnit"] = result[2]
@@ -110,8 +107,6 @@ func (this *IndexAction) RunPost(params struct{}) {
this.Data["todayTrafficUnit"] = ""
}
this.Data["todayCountIPs"] = todayCountIPs
// 24小时流量趋势
{
statMaps := []maps.Map{}
@@ -142,7 +137,6 @@ func (this *IndexAction) RunPost(params struct{}) {
"countAttackRequests": stat.CountAttackRequests,
"attackBytes": stat.AttackBytes,
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
"countIPs": stat.CountIPs,
})
}
this.Data["dailyTrafficStats"] = statMaps

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build !plus
package dashboard

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dashboard

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dbnodeutils

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package db

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package db

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package domainutils

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
@@ -84,8 +84,6 @@ func (this *CreatePopupAction) RunPost(params struct {
ParamEdgeDNSAPIAccessKeyId string
ParamEdgeDNSAPIAccessKeySecret string
MinTTL int32
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -179,7 +177,6 @@ func (this *CreatePopupAction) RunPost(params struct {
Name: params.Name,
Type: params.Type,
ApiParamsJSON: apiParams.AsJSON(),
MinTTL: params.MinTTL,
})
if err != nil {
this.ErrorPage(err)

View File

@@ -59,7 +59,6 @@ func (this *ProviderAction) RunGet(params struct {
"name": provider.Name,
"type": provider.Type,
"typeName": provider.TypeName,
"minTTL": provider.MinTTL,
"apiParams": apiParams,
"localEdgeDNS": localEdgeDNSMap,
}

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build !plus
package providers

View File

@@ -1,4 +1,4 @@
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package providers

View File

@@ -50,7 +50,6 @@ func (this *UpdatePopupAction) RunGet(params struct {
"name": provider.Name,
"type": provider.Type,
"typeName": provider.TypeName,
"minTTL": provider.MinTTL,
"params": apiParams,
}
@@ -115,8 +114,6 @@ func (this *UpdatePopupAction) RunPost(params struct {
ParamEdgeDNSAPIAccessKeyId string
ParamEdgeDNSAPIAccessKeySecret string
MinTTL int32
Must *actions.Must
CSRF *actionutils.CSRF
}) {
@@ -211,7 +208,6 @@ func (this *UpdatePopupAction) RunPost(params struct {
_, err := this.RPC().DNSProviderRPC().UpdateDNSProvider(this.AdminContext(), &pb.UpdateDNSProviderRequest{
DnsProviderId: params.ProviderId,
Name: params.Name,
MinTTL: params.MinTTL,
ApiParamsJSON: apiParams.AsJSON(),
})
if err != nil {

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package files

View File

@@ -1,4 +1,4 @@
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package files

View File

@@ -237,27 +237,15 @@ func (this *IndexAction) RunPost(params struct {
}
// 写入SESSION
var currentIP = loginutils.RemoteIP(&this.ActionObject)
var localSid = rands.HexString(32)
this.Data["localSid"] = localSid
this.Data["ip"] = currentIP
this.Data["ip"] = loginutils.RemoteIP(&this.ActionObject)
params.Auth.StoreAdmin(adminId, params.Remember, localSid)
// 清理老的SESSION
_, err = this.RPC().LoginSessionRPC().ClearOldLoginSessions(this.AdminContext(), &pb.ClearOldLoginSessionsRequest{
Sid: this.Session().Sid,
Ip: currentIP,
})
if err != nil {
this.ErrorPage(err)
return
}
// 记录日志
err = dao.SharedLogDAO.CreateAdminLog(rpcClient.Context(adminId), oplogs.LevelInfo, this.Request.URL.Path, langs.DefaultMessage(codes.AdminLogin_LogSuccess, params.Username), loginutils.RemoteIP(&this.ActionObject), codes.AdminLogin_LogSuccess, []any{params.Username})
if err != nil {
this.ErrorPage(err)
return
utils.PrintError(err)
}
this.Success()
@@ -265,7 +253,6 @@ func (this *IndexAction) RunPost(params struct {
// 检查登录区域
func (this *IndexAction) checkRegion() bool {
return true // 暂时不限制
var ip = loginutils.RemoteIP(&this.ActionObject)
var result = iplibrary.LookupIP(ip)
if result != nil && result.IsOk() && result.CountryId() > 0 && lists.ContainsInt64([]int64{9, 10}, result.CountryId()) {

View File

@@ -1,4 +1,4 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package loginutils

Some files were not shown because too many files have changed in this diff Show More