diff --git a/README.md b/README.md index 8543a4c0..9d55f911 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,4 @@ 其中的组件源码地址如下: * [边缘节点](https://github.com/TeaOSLab/EdgeNode) * [API节点](https://github.com/TeaOSLab/EdgeAPI) -* [管理平台](https://github.com/TeaOSLab/EdgeAdmin) +* [管理平台](https://github.com/TeaOSLab/EdgeAdmin) \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index 39a0b86f..6862a8c0 100755 --- a/build/build.sh +++ b/build/build.sh @@ -103,23 +103,21 @@ function build() { GCC_DIR="" CC_PATH="" CXX_PATH="" - if [ "${ARCH}" == "amd64" ]; then - GCC_DIR="/usr/local/gcc/x86_64-unknown-linux-gnu/bin" - CC_PATH="x86_64-unknown-linux-gnu-gcc" - CXX_PATH="x86_64-unknown-linux-gnu-g++" + if [[ "${ARCH}" == "amd64" && "${OS}" == "linux" ]]; then + CC_PATH=$(command -v x86_64-linux-musl-gcc) + CXX_PATH=$(command -v x86_64-linux-musl-g++) fi - if [ "${ARCH}" == "arm64" ]; then - GCC_DIR="/usr/local/gcc/aarch64-unknown-linux-gnu/bin" - CC_PATH="aarch64-unknown-linux-gnu-gcc" - CXX_PATH="aarch64-unknown-linux-gnu-g++" + if [[ "${ARCH}" == "arm64" && "${OS}" == "linux" ]]; then + CC_PATH=$(command -v aarch64-linux-musl-gcc) + CXX_PATH=$(command -v aarch64-linux-musl-g++) fi # build echo "building ${NAME} ..." - if [ -f "${GCC_DIR}/${CC_PATH}" ]; then - echo " building ${NAME} with gcc ..." - env CC="${GCC_DIR}/${CC_PATH}" \ - CXX="${GCC_DIR}/${CXX_PATH}" \ + if [ -f $CC_PATH ]; then + echo " building ${NAME} with musl gcc ..." + env CC=$CC_PATH \ + CXX=$CXX_PATH \ CGO_ENABLED=1 \ GOOS="$OS" GOARCH="$ARCH" go build -trimpath -tags "${TAG} gcc" -ldflags="-linkmode external -extldflags -static -s -w" -o "$DIST"/bin/${NAME} "$ROOT"/../cmd/edge-admin/main.go else diff --git a/cmd/edge-admin/main.go b/cmd/edge-admin/main.go index 2e4eaa28..b3732968 100644 --- a/cmd/edge-admin/main.go +++ b/cmd/edge-admin/main.go @@ -4,6 +4,11 @@ import ( "bytes" "flag" "fmt" + "log" + "os" + "os/exec" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/apps" "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" @@ -19,10 +24,6 @@ import ( _ "github.com/iwind/TeaGo/bootstrap" "github.com/iwind/TeaGo/maps" "github.com/iwind/gosock/pkg/gosock" - "log" - "os" - "os/exec" - "time" ) func main() { diff --git a/go.mod b/go.mod index fac2db29..052df03d 100644 --- a/go.mod +++ b/go.mod @@ -1,51 +1,56 @@ module github.com/TeaOSLab/EdgeAdmin -go 1.21 +go 1.22 replace github.com/TeaOSLab/EdgeCommon => ../EdgeCommon +replace github.com/TeaOSLab/EdgePlus => ../EdgePlus + require ( github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000 - github.com/cespare/xxhash/v2 v2.2.0 - github.com/go-sql-driver/mysql v1.5.0 - github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9 - github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 - github.com/miekg/dns v1.1.43 - github.com/quic-go/quic-go v0.42.0 - github.com/shirou/gopsutil/v3 v3.22.5 + github.com/TeaOSLab/EdgePlus v0.0.0-00010101000000-000000000000 + github.com/cespare/xxhash/v2 v2.3.0 + github.com/go-sql-driver/mysql v1.8.1 + github.com/iwind/TeaGo v0.0.0-20240508072741-7647e70b7070 + github.com/iwind/gosock v0.0.0-20220505115348-f88412125a62 + github.com/miekg/dns v1.1.59 + github.com/quic-go/quic-go v0.44.0 + github.com/shirou/gopsutil/v3 v3.24.2 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/tealeg/xlsx/v3 v3.2.4 github.com/xlzd/gotp v0.1.0 - golang.org/x/crypto v0.22.0 - golang.org/x/sys v0.19.0 + golang.org/x/crypto v0.23.0 + golang.org/x/sys v0.20.0 google.golang.org/grpc v1.63.2 gopkg.in/yaml.v3 v3.0.1 ) require ( + filippo.io/edwards25519 v1.1.0 // indirect github.com/frankban/quicktest v1.11.3 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/btree v1.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f // indirect - github.com/kr/pretty v0.2.1 // indirect + github.com/google/pprof v0.0.0-20240509144519-723abb6459b7 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/onsi/ginkgo/v2 v2.17.1 // indirect + github.com/onsi/ginkgo/v2 v2.17.3 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/rogpeppe/fastuuid v1.2.0 // indirect + github.com/rogpeppe/go-internal v1.12.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 + github.com/stretchr/testify v1.9.0 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/mock v0.4.0 // indirect - golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.19.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/tools v0.21.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/go.sum b/go.sum index c7d8ad62..0dd2ec1a 100644 --- a/go.sum +++ b/go.sum @@ -1,53 +1,52 @@ -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.5.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= +github.com/frankban/quicktest v1.11.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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-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= -github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/google/pprof v0.0.0-20240509144519-723abb6459b7 h1:velgFPYr1X9TDwLIfkV7fWqsFlf7TeP11M/7kPd/dVI= +github.com/google/pprof v0.0.0-20240509144519-723abb6459b7/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/iwind/TeaGo v0.0.0-20240508072741-7647e70b7070 h1:0YHZBcuXYbvtQ0XfEdtzr/XybiMrwD8vV1lvgAwzUW4= +github.com/iwind/gosock v0.0.0-20220505115348-f88412125a62 h1:HJH6RDheAY156DnIfJSD/bEvqyXzsZuE2gzs8PuUjoo= +github.com/iwind/gosock v0.0.0-20220505115348-f88412125a62/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= -github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= -github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/miekg/dns v1.1.59 h1:C9EXc/UToRwKLhK5wKU/I4QVsBUc8kE6MkHBkeypWZs= +github.com/miekg/dns v1.1.59/go.mod h1:nZpewl5p6IvctfgrckopVx2OlSEHPRO/U4SYkRklrEk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/onsi/ginkgo/v2 v2.17.3 h1:oJcvKpIb7/8uLpDDtnQuf18xVnwKp8DTD7DQ6gTd/MU= +github.com/onsi/ginkgo/v2 v2.17.3/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= +github.com/onsi/gomega v1.33.0 h1:snPCflnZrpMsy94p4lXVEkHo12lmPnc3vY5XBbreexE= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug= github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -56,68 +55,66 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utpM= -github.com/quic-go/quic-go v0.42.0/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M= +github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0= +github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa h1:2cO3RojjYl3hVTbEvJVqrMaFmORhL6O06qdW42toftk= github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa/go.mod h1:Yjr3bdWaVWyME1kha7X0jsz3k2DgXNa1Pj3XGyUAbx8= -github.com/shirou/gopsutil/v3 v3.22.5 h1:atX36I/IXgFiB81687vSiBI5zrMsxcIBkP9cQMJQoJA= -github.com/shirou/gopsutil/v3 v3.22.5/go.mod h1:so9G9VzeHt/hsd0YwqprnjHnfARAUktauykSbr+y2gA= +github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y= +github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 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/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tealeg/xlsx/v3 v3.2.4 h1:QPuk5v1xEivxoEUFmqszqINF52ppWCMejEd11ju3180= +github.com/tealeg/xlsx/v3 v3.2.4/go.mod h1:0j6U48nJBWJsvo1FmYilbGo81oRdLyYInWvjb2WAeOA= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= 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= -github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -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/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= 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= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= @@ -126,7 +123,7 @@ google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDom google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/apps/app_cmd.go b/internal/apps/app_cmd.go index 59bf8bdc..f891a568 100644 --- a/internal/apps/app_cmd.go +++ b/internal/apps/app_cmd.go @@ -3,11 +3,6 @@ package apps import ( "errors" "fmt" - teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" - "github.com/iwind/TeaGo/logs" - "github.com/iwind/TeaGo/maps" - "github.com/iwind/TeaGo/types" - "github.com/iwind/gosock/pkg/gosock" "os" "os/exec" "path/filepath" @@ -15,6 +10,12 @@ import ( "strconv" "strings" "time" + + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" + "github.com/iwind/TeaGo/logs" + "github.com/iwind/TeaGo/maps" + "github.com/iwind/TeaGo/types" + "github.com/iwind/gosock/pkg/gosock" ) // AppCmd App命令帮助 diff --git a/internal/apps/log_writer.go b/internal/apps/log_writer.go index 91283059..ee69d277 100644 --- a/internal/apps/log_writer.go +++ b/internal/apps/log_writer.go @@ -1,16 +1,17 @@ package apps import ( - "github.com/TeaOSLab/EdgeAdmin/internal/goman" - "github.com/TeaOSLab/EdgeAdmin/internal/utils/sizes" - "github.com/iwind/TeaGo/Tea" - "github.com/iwind/TeaGo/files" - timeutil "github.com/iwind/TeaGo/utils/time" "log" "os" "runtime" "strconv" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/goman" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/sizes" + "github.com/iwind/TeaGo/Tea" + "github.com/iwind/TeaGo/files" + timeutil "github.com/iwind/TeaGo/utils/time" ) type LogWriter struct { diff --git a/internal/configloaders/admin_module_test.go b/internal/configloaders/admin_module_test.go index 6c69102f..ba03bd4d 100644 --- a/internal/configloaders/admin_module_test.go +++ b/internal/configloaders/admin_module_test.go @@ -1,8 +1,9 @@ package configloaders import ( - "github.com/iwind/TeaGo/logs" "testing" + + "github.com/iwind/TeaGo/logs" ) func TestLoadAdminModuleMapping(t *testing.T) { diff --git a/internal/configloaders/admin_ui_config.go b/internal/configloaders/admin_ui_config.go index 559af3e5..d7b60d6a 100644 --- a/internal/configloaders/admin_ui_config.go +++ b/internal/configloaders/admin_ui_config.go @@ -2,6 +2,9 @@ package configloaders import ( "encoding/json" + "reflect" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/langs" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,8 +12,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/logs" - "reflect" - "time" ) var sharedAdminUIConfig *systemconfigs.AdminUIConfig = nil diff --git a/internal/configloaders/admin_ui_config_test.go b/internal/configloaders/admin_ui_config_test.go index 43733408..da8e7be9 100644 --- a/internal/configloaders/admin_ui_config_test.go +++ b/internal/configloaders/admin_ui_config_test.go @@ -1,9 +1,10 @@ package configloaders import ( - _ "github.com/iwind/TeaGo/bootstrap" "testing" "time" + + _ "github.com/iwind/TeaGo/bootstrap" ) func TestLoadUIConfig(t *testing.T) { diff --git a/internal/configloaders/log_config.go b/internal/configloaders/log_config.go index c6283570..59a3bb88 100644 --- a/internal/configloaders/log_config.go +++ b/internal/configloaders/log_config.go @@ -2,11 +2,12 @@ package configloaders import ( "encoding/json" + "reflect" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/logs" - "reflect" ) var sharedLogConfig *systemconfigs.LogConfig = nil diff --git a/internal/configloaders/security_config.go b/internal/configloaders/security_config.go index e0b9ef4e..4d741eb6 100644 --- a/internal/configloaders/security_config.go +++ b/internal/configloaders/security_config.go @@ -2,12 +2,13 @@ package configloaders import ( "encoding/json" + "reflect" + "github.com/TeaOSLab/EdgeAdmin/internal/events" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/logs" - "reflect" ) const ( diff --git a/internal/configloaders/security_config_test.go b/internal/configloaders/security_config_test.go index b685fc71..d90c8ece 100644 --- a/internal/configloaders/security_config_test.go +++ b/internal/configloaders/security_config_test.go @@ -1,9 +1,10 @@ package configloaders import ( - _ "github.com/iwind/TeaGo/bootstrap" "testing" "time" + + _ "github.com/iwind/TeaGo/bootstrap" ) func TestLoadSecurityConfig(t *testing.T) { diff --git a/internal/configs/api_config.go b/internal/configs/api_config.go index f248d3dc..d467b25a 100644 --- a/internal/configs/api_config.go +++ b/internal/configs/api_config.go @@ -2,11 +2,12 @@ package configs import ( "errors" + "os" + "path/filepath" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/iwind/TeaGo/Tea" "gopkg.in/yaml.v3" - "os" - "path/filepath" ) const ConfigFileName = "api_admin.yaml" diff --git a/internal/configs/api_config_test.go b/internal/configs/api_config_test.go index 8fe74063..e4865deb 100644 --- a/internal/configs/api_config_test.go +++ b/internal/configs/api_config_test.go @@ -1,9 +1,10 @@ package configs import ( + "testing" + _ "github.com/iwind/TeaGo/bootstrap" "gopkg.in/yaml.v3" - "testing" ) func TestLoadAPIConfig(t *testing.T) { diff --git a/internal/configs/simple_db_config.go b/internal/configs/simple_db_config.go index f319043d..f8869358 100644 --- a/internal/configs/simple_db_config.go +++ b/internal/configs/simple_db_config.go @@ -1,14 +1,15 @@ -// 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 configs import ( "fmt" + "net/url" + "os" + "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/dbs" "gopkg.in/yaml.v3" - "net/url" - "os" ) type SimpleDBConfig struct { @@ -22,7 +23,7 @@ type SimpleDBConfig struct { 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", + Dsn: url.QueryEscape(this.User) + ":" + this.Password + "@tcp(" + this.Host + ")/" + url.PathEscape(this.Database) + "?charset=utf8mb4&timeout=30s&multiStatements=true", Prefix: "edge", } dbConfig.Models.Package = "internal/db/models" diff --git a/internal/const/const.go b/internal/const/const.go index dc17ddc1..45132ac8 100644 --- a/internal/const/const.go +++ b/internal/const/const.go @@ -1,9 +1,9 @@ package teaconst const ( - Version = "1.3.9" + Version = "1.4.1" - APINodeVersion = "1.3.9" + APINodeVersion = "1.4.1" ProductName = "Edge Admin" ProcessName = "edge-admin" @@ -16,5 +16,5 @@ const ( SessionAdminId = "adminId" SystemdServiceName = "edge-admin" - UpdatesURL = "https://goedge.cn/api/boot/versions?os=${os}&arch=${arch}&version=${version}" + UpdatesURL = "https://goedge.cloud/api/boot/versions?os=${os}&arch=${arch}&version=${version}" ) diff --git a/internal/csrf/utils.go b/internal/csrf/utils.go index 14f14522..3a52b047 100644 --- a/internal/csrf/utils.go +++ b/internal/csrf/utils.go @@ -4,10 +4,11 @@ import ( "crypto/sha256" "encoding/base64" "fmt" - "github.com/TeaOSLab/EdgeAdmin/internal/configs" - "github.com/iwind/TeaGo/types" "strconv" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/configs" + "github.com/iwind/TeaGo/types" ) // Generate 生成Token diff --git a/internal/gen/generate.go b/internal/gen/generate.go index b2b4f733..6d5ced0b 100644 --- a/internal/gen/generate.go +++ b/internal/gen/generate.go @@ -6,6 +6,10 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "os" + "path/filepath" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds/condutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" @@ -15,9 +19,6 @@ import ( "github.com/iwind/TeaGo/files" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" - "io" - "os" - "path/filepath" ) func Generate() error { @@ -39,8 +40,11 @@ func generateComponentsJSFile() error { } else { webRoot = Tea.Root + "/web/public/js/components/" } - var f = files.NewFile(webRoot) - + gitDir, gDirFound := os.LookupEnv("GithubDIR") + if gDirFound { + webRoot = gitDir + "/EdgeAdmin/web/public/js/components/" + } + f := files.NewFile(webRoot) f.Range(func(file *files.File) { if !file.IsFile() { return @@ -156,7 +160,12 @@ func generateComponentsJSFile() error { buffer.Write([]byte{';', '\n', '\n'}) } - fp, err := os.OpenFile(filepath.Clean(Tea.PublicFile("/js/components.src.js")), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0777) + pubPath := Tea.PublicFile("/js/components.src.js") + if gDirFound { + pubPath = gitDir + "/EdgeAdmin/web/public/js/components.src.js" + } + + fp, err := os.OpenFile(filepath.Clean(pubPath), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0777) if err != nil { return err } diff --git a/internal/nodes/admin_node.go b/internal/nodes/admin_node.go index 7d6100e8..f7b4de77 100644 --- a/internal/nodes/admin_node.go +++ b/internal/nodes/admin_node.go @@ -3,6 +3,16 @@ package nodes import ( "errors" "fmt" + "log" + "net" + "os" + "os/exec" + "os/signal" + "path/filepath" + "strings" + "syscall" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" @@ -18,15 +28,6 @@ import ( "github.com/iwind/TeaGo/types" "github.com/iwind/gosock/pkg/gosock" "gopkg.in/yaml.v3" - "log" - "net" - "os" - "os/exec" - "os/signal" - "path/filepath" - "strings" - "syscall" - "time" ) var SharedAdminNode *AdminNode = nil diff --git a/internal/nodes/admin_node_ext.go b/internal/nodes/admin_node_ext.go index 062886ef..78381140 100644 --- a/internal/nodes/admin_node_ext.go +++ b/internal/nodes/admin_node_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package nodes @@ -13,6 +13,6 @@ func (this *AdminNode) startIPLibrary() { logs.Println("[NODE]initializing ip library ...") err := iplibrary.InitDefault() if err != nil { - logs.Println("[NODE]initialize ip library failed: "+err.Error()) + logs.Println("[NODE]initialize ip library failed: " + err.Error()) } } diff --git a/internal/nodes/session_manager.go b/internal/nodes/session_manager.go index 50a700da..a09d5c79 100644 --- a/internal/nodes/session_manager.go +++ b/internal/nodes/session_manager.go @@ -1,16 +1,17 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package nodes import ( "encoding/json" + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/ttlcache" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/logs" - "strings" - "time" ) // SessionManager SESSION管理 diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go index 753a4e70..72585f6c 100644 --- a/internal/rpc/rpc_client.go +++ b/internal/rpc/rpc_client.go @@ -6,6 +6,12 @@ import ( "encoding/base64" "errors" "fmt" + "net" + "net/url" + "strings" + "sync" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/encrypt" @@ -22,11 +28,6 @@ import ( "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" - "net" - "net/url" - "strings" - "sync" - "time" ) // RPCClient RPC客户端 diff --git a/internal/rpc/rpc_client_test.go b/internal/rpc/rpc_client_test.go index bbeea1d5..e022f2d7 100644 --- a/internal/rpc/rpc_client_test.go +++ b/internal/rpc/rpc_client_test.go @@ -1,12 +1,13 @@ package rpc import ( + "testing" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" _ "github.com/iwind/TeaGo/bootstrap" stringutil "github.com/iwind/TeaGo/utils/string" - "testing" - "time" ) func TestRPCClient_NodeRPC(t *testing.T) { diff --git a/internal/rpc/rpc_utils.go b/internal/rpc/rpc_utils.go index c0358064..996aa647 100644 --- a/internal/rpc/rpc_utils.go +++ b/internal/rpc/rpc_utils.go @@ -1,11 +1,12 @@ package rpc import ( + "strings" + "sync" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "strings" - "sync" ) var sharedRPC *RPCClient = nil diff --git a/internal/tasks/task_check_updates.go b/internal/tasks/task_check_updates.go index 9c7fbf5c..48eb436a 100644 --- a/internal/tasks/task_check_updates.go +++ b/internal/tasks/task_check_updates.go @@ -6,6 +6,12 @@ import ( "encoding/json" "errors" "fmt" + "io" + "net/http" + "runtime" + "strings" + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/events" "github.com/TeaOSLab/EdgeAdmin/internal/goman" @@ -15,11 +21,6 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" - "io" - "net/http" - "runtime" - "strings" - "time" ) func init() { diff --git a/internal/tasks/task_sync_api_nodes.go b/internal/tasks/task_sync_api_nodes.go index 4d588055..e230b4b9 100644 --- a/internal/tasks/task_sync_api_nodes.go +++ b/internal/tasks/task_sync_api_nodes.go @@ -3,6 +3,12 @@ package tasks import ( "context" "crypto/tls" + "net/url" + "sort" + "strings" + "sync" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/events" @@ -15,11 +21,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" - "net/url" - "sort" - "strings" - "sync" - "time" ) func init() { diff --git a/internal/tasks/task_sync_api_nodes_test.go b/internal/tasks/task_sync_api_nodes_test.go index 2a91f5ee..d622d983 100644 --- a/internal/tasks/task_sync_api_nodes_test.go +++ b/internal/tasks/task_sync_api_nodes_test.go @@ -1,8 +1,9 @@ package tasks import ( - _ "github.com/iwind/TeaGo/bootstrap" "testing" + + _ "github.com/iwind/TeaGo/bootstrap" ) func TestSyncAPINodesTask_Loop(t *testing.T) { diff --git a/internal/tasks/task_sync_cluster.go b/internal/tasks/task_sync_cluster.go index b5b329b7..dc88e2a1 100644 --- a/internal/tasks/task_sync_cluster.go +++ b/internal/tasks/task_sync_cluster.go @@ -1,6 +1,8 @@ package tasks import ( + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/events" "github.com/TeaOSLab/EdgeAdmin/internal/goman" @@ -12,7 +14,6 @@ import ( _ "github.com/iwind/TeaGo/bootstrap" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" - "time" ) func init() { diff --git a/internal/ttlcache/cache.go b/internal/ttlcache/cache.go index 28dca8e3..206e4832 100644 --- a/internal/ttlcache/cache.go +++ b/internal/ttlcache/cache.go @@ -1,8 +1,9 @@ package ttlcache import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils" ) var DefaultCache = NewCache() diff --git a/internal/ttlcache/cache_test.go b/internal/ttlcache/cache_test.go index 0ffcf118..ca0d2791 100644 --- a/internal/ttlcache/cache_test.go +++ b/internal/ttlcache/cache_test.go @@ -1,11 +1,12 @@ package ttlcache import ( - "github.com/iwind/TeaGo/rands" "runtime" "strconv" "testing" "time" + + "github.com/iwind/TeaGo/rands" ) func TestNewCache(t *testing.T) { @@ -68,7 +69,7 @@ func TestCache_Read(t *testing.T) { total := 0 for _, piece := range cache.pieces { - //t.Log(len(piece.m), "keys") + // t.Log(len(piece.m), "keys") total += len(piece.m) } t.Log(total, "total keys") diff --git a/internal/ttlcache/piece.go b/internal/ttlcache/piece.go index eefd168b..394f2e7e 100644 --- a/internal/ttlcache/piece.go +++ b/internal/ttlcache/piece.go @@ -1,9 +1,10 @@ package ttlcache import ( - "github.com/iwind/TeaGo/types" "sync" "time" + + "github.com/iwind/TeaGo/types" ) type Piece struct { @@ -16,7 +17,7 @@ func NewPiece(maxItems int) *Piece { return &Piece{m: map[uint64]*Item{}, maxItems: maxItems} } -func (this *Piece) Add(key uint64, item *Item) () { +func (this *Piece) Add(key uint64, item *Item) { this.locker.Lock() if len(this.m) >= this.maxItems { this.locker.Unlock() diff --git a/internal/ttlcache/piece_test.go b/internal/ttlcache/piece_test.go index 0ec0ff15..1fae7645 100644 --- a/internal/ttlcache/piece_test.go +++ b/internal/ttlcache/piece_test.go @@ -1,9 +1,10 @@ package ttlcache import ( - "github.com/iwind/TeaGo/rands" "testing" "time" + + "github.com/iwind/TeaGo/rands" ) func TestPiece_Add(t *testing.T) { diff --git a/internal/utils/apinodeutils/deploy_manager.go b/internal/utils/apinodeutils/deploy_manager.go index 8599df32..53978450 100644 --- a/internal/utils/apinodeutils/deploy_manager.go +++ b/internal/utils/apinodeutils/deploy_manager.go @@ -1,10 +1,11 @@ package apinodeutils import ( + "regexp" + "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/files" stringutil "github.com/iwind/TeaGo/utils/string" - "regexp" ) // DeployManager 节点部署文件管理器 diff --git a/internal/utils/apinodeutils/manager.go b/internal/utils/apinodeutils/manager.go index d65a716d..f8b2e56b 100644 --- a/internal/utils/apinodeutils/manager.go +++ b/internal/utils/apinodeutils/manager.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package apinodeutils diff --git a/internal/utils/apinodeutils/upgrader.go b/internal/utils/apinodeutils/upgrader.go index 5f2b78f5..8131d677 100644 --- a/internal/utils/apinodeutils/upgrader.go +++ b/internal/utils/apinodeutils/upgrader.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package apinodeutils @@ -8,16 +8,17 @@ import ( "crypto/md5" "errors" "fmt" + "io" + "os" + "path/filepath" + "runtime" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/types" stringutil "github.com/iwind/TeaGo/utils/string" - "io" - "os" - "path/filepath" - "runtime" ) type Progress struct { diff --git a/internal/utils/apinodeutils/upgrader_test.go b/internal/utils/apinodeutils/upgrader_test.go index f3b51e2e..1486e60b 100644 --- a/internal/utils/apinodeutils/upgrader_test.go +++ b/internal/utils/apinodeutils/upgrader_test.go @@ -1,12 +1,13 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package apinodeutils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils/apinodeutils" - _ "github.com/iwind/TeaGo/bootstrap" "runtime" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils/apinodeutils" + _ "github.com/iwind/TeaGo/bootstrap" ) func TestUpgrader_CanUpgrade(t *testing.T) { diff --git a/internal/utils/apinodeutils/utils.go b/internal/utils/apinodeutils/utils.go index 19d87ce7..0eb0f05b 100644 --- a/internal/utils/apinodeutils/utils.go +++ b/internal/utils/apinodeutils/utils.go @@ -1,18 +1,19 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package apinodeutils import ( "bytes" "errors" - teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" - "github.com/iwind/TeaGo/Tea" - stringutil "github.com/iwind/TeaGo/utils/string" "os" "os/exec" "regexp" "runtime" "strings" + + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" + "github.com/iwind/TeaGo/Tea" + stringutil "github.com/iwind/TeaGo/utils/string" ) func CanUpgrade(apiVersion string, osName string, arch string) (canUpgrade bool, reason string) { diff --git a/internal/utils/dateutils/utils.go b/internal/utils/dateutils/utils.go index c1d63c8e..df5dab14 100644 --- a/internal/utils/dateutils/utils.go +++ b/internal/utils/dateutils/utils.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package dateutils diff --git a/internal/utils/dns.go b/internal/utils/dns.go new file mode 100644 index 00000000..b57bcaab --- /dev/null +++ b/internal/utils/dns.go @@ -0,0 +1,81 @@ +package utils + +import ( + "context" + "net" + "regexp" + "sync" + "time" + + dig "github.com/TeaOSLab/EdgeCommon/pkg/utils" + "golang.org/x/net/idna" +) + +func stringInSlice(str string, slice []string) bool { + for _, s := range slice { + if s == str { + return true + } + } + return false +} + +func DnsCheck(domains []string, nodeIps []string) map[string]bool { + var wg sync.WaitGroup + ipMap := &sync.Map{} + concurrent := 10 + counter := make(chan struct{}, concurrent) + + for _, domain := range domains { + counter <- struct{}{} + wg.Add(1) + go func(domain string) { + defer func() { + <-counter + wg.Done() + }() + // 中文域名转换 + if !regexp.MustCompile(`^[a-zA-Z0-9-.]+$`).MatchString(domain) { + unicodeDomain, err := idna.ToASCII(domain) + if err == nil && len(unicodeDomain) > 0 { + domain = unicodeDomain + } + } + dnsIps, err := dig.DigTraceIP(domain) + if err != nil || len(dnsIps) < 1 { + ipMap.Store(domain, false) + } else { + var flag = false + for _, ip := range dnsIps{ + flag = stringInSlice(ip, nodeIps) + if flag { + break + } + } + ipMap.Store(domain, flag) + } + + }(domain) + } + + wg.Wait() + + resultMap := make(map[string]bool) + ipMap.Range(func(key, value interface{}) bool { + resultMap[key.(string)] = value.(bool) + return true + }) + + return resultMap +} + +func LookupIPWithTimeout(domain string, timeoutMS int64) ([]string, error) { + ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(timeoutMS)) + defer cancel() + r := net.DefaultResolver + ips, err := r.LookupHost(ctx, domain) + if err != nil { + return nil, err + } + return ips, nil +} diff --git a/internal/utils/email.go b/internal/utils/email.go index acbd12fc..4afabdfc 100644 --- a/internal/utils/email.go +++ b/internal/utils/email.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils diff --git a/internal/utils/email_test.go b/internal/utils/email_test.go index 647c4b41..b767d08c 100644 --- a/internal/utils/email_test.go +++ b/internal/utils/email_test.go @@ -1,11 +1,12 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils_test import ( + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/iwind/TeaGo/assert" - "testing" ) func TestValidateEmail(t *testing.T) { diff --git a/internal/utils/exec/cmd.go b/internal/utils/exec/cmd.go index 997bdf1b..afbd7972 100644 --- a/internal/utils/exec/cmd.go +++ b/internal/utils/exec/cmd.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package executils diff --git a/internal/utils/exec/cmd_test.go b/internal/utils/exec/cmd_test.go index 5d2433fd..9a8b0a74 100644 --- a/internal/utils/exec/cmd_test.go +++ b/internal/utils/exec/cmd_test.go @@ -1,11 +1,12 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package executils_test import ( - executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" "testing" "time" + + executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" ) func TestNewTimeoutCmd_Sleep(t *testing.T) { diff --git a/internal/utils/exec/look_linux.go b/internal/utils/exec/look_linux.go index ab70077e..fecff41e 100644 --- a/internal/utils/exec/look_linux.go +++ b/internal/utils/exec/look_linux.go @@ -1,14 +1,15 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build linux package executils import ( - "golang.org/x/sys/unix" "io/fs" "os" "os/exec" "syscall" + + "golang.org/x/sys/unix" ) // LookPath customize our LookPath() function, to work in broken $PATH environment variable diff --git a/internal/utils/exec/look_others.go b/internal/utils/exec/look_others.go index a759c8ef..38c7e943 100644 --- a/internal/utils/exec/look_others.go +++ b/internal/utils/exec/look_others.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !linux package executils diff --git a/internal/utils/firewall.go b/internal/utils/firewall.go index 7c4dc258..54013aee 100644 --- a/internal/utils/firewall.go +++ b/internal/utils/firewall.go @@ -1,13 +1,14 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils import ( + "os/exec" + "runtime" + executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/types" - "os/exec" - "runtime" ) func AddPortsToFirewall(ports []int) { diff --git a/internal/utils/ip_utils.go b/internal/utils/ip_utils.go index f2bae13d..f456ee55 100644 --- a/internal/utils/ip_utils.go +++ b/internal/utils/ip_utils.go @@ -3,10 +3,11 @@ package utils import ( "bytes" "errors" - "github.com/TeaOSLab/EdgeCommon/pkg/iputils" - "github.com/iwind/TeaGo/types" "net" "strings" + + "github.com/TeaOSLab/EdgeCommon/pkg/iputils" + "github.com/iwind/TeaGo/types" ) // ParseIPValue 解析IP值 diff --git a/internal/utils/json_test.go b/internal/utils/json_test.go index ee9d8cac..c4c5f6c7 100644 --- a/internal/utils/json_test.go +++ b/internal/utils/json_test.go @@ -3,9 +3,10 @@ package utils_test import ( + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/iwind/TeaGo/assert" - "testing" ) func TestJSONClone(t *testing.T) { @@ -25,11 +26,10 @@ func TestJSONClone(t *testing.T) { } } - func TestJSONIsNull(t *testing.T) { var a = assert.NewAssertion(t) a.IsTrue(utils.JSONIsNull(nil)) a.IsTrue(utils.JSONIsNull([]byte{})) a.IsTrue(utils.JSONIsNull([]byte("null"))) a.IsFalse(utils.JSONIsNull([]byte{1, 2, 3})) -} \ No newline at end of file +} diff --git a/internal/utils/lookup.go b/internal/utils/lookup.go index ea7c8456..9bcc9269 100644 --- a/internal/utils/lookup.go +++ b/internal/utils/lookup.go @@ -1,12 +1,13 @@ package utils import ( + "sync" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" "github.com/miekg/dns" - "sync" ) var sharedDNSClient *dns.Client diff --git a/internal/utils/lookup_test.go b/internal/utils/lookup_test.go index 2ed8f251..f21fb746 100644 --- a/internal/utils/lookup_test.go +++ b/internal/utils/lookup_test.go @@ -3,8 +3,9 @@ package utils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils" ) func TestLookupCNAME(t *testing.T) { diff --git a/internal/utils/numberutils/utils.go b/internal/utils/numberutils/utils.go index 9650ebfc..63a087cf 100644 --- a/internal/utils/numberutils/utils.go +++ b/internal/utils/numberutils/utils.go @@ -2,10 +2,11 @@ package numberutils import ( "fmt" - "github.com/iwind/TeaGo/types" "regexp" "strconv" "strings" + + "github.com/iwind/TeaGo/types" ) func FormatInt64(value int64) string { diff --git a/internal/utils/numberutils/utils_test.go b/internal/utils/numberutils/utils_test.go index c652f9e6..020d57f1 100644 --- a/internal/utils/numberutils/utils_test.go +++ b/internal/utils/numberutils/utils_test.go @@ -3,9 +3,10 @@ package numberutils_test import ( + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/iwind/TeaGo/assert" - "testing" ) func TestFormatBytes(t *testing.T) { diff --git a/internal/utils/otputils/utils.go b/internal/utils/otputils/utils.go index 44aff51c..c1e7c205 100644 --- a/internal/utils/otputils/utils.go +++ b/internal/utils/otputils/utils.go @@ -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 otputils diff --git a/internal/utils/otputils/utils_test.go b/internal/utils/otputils/utils_test.go index 4a1124f3..ac0bb64f 100644 --- a/internal/utils/otputils/utils_test.go +++ b/internal/utils/otputils/utils_test.go @@ -1,10 +1,11 @@ -// 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 otputils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils" ) func TestFixIssuer(t *testing.T) { diff --git a/internal/utils/service.go b/internal/utils/service.go index 872d182e..3c2c64fb 100644 --- a/internal/utils/service.go +++ b/internal/utils/service.go @@ -1,14 +1,15 @@ package utils import ( - "github.com/iwind/TeaGo/Tea" - "github.com/iwind/TeaGo/files" - "github.com/iwind/TeaGo/logs" "log" "os" "path/filepath" "runtime" "sync" + + "github.com/iwind/TeaGo/Tea" + "github.com/iwind/TeaGo/files" + "github.com/iwind/TeaGo/logs" ) // 服务管理器 @@ -42,7 +43,7 @@ func (this *ServiceManager) setup() { _ = logFile.Delete() } - //logger + // logger fp, err := os.OpenFile(Tea.Root+"/logs/service.log", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) if err != nil { logs.Error(err) diff --git a/internal/utils/service_linux.go b/internal/utils/service_linux.go index 3cf370b8..00040884 100644 --- a/internal/utils/service_linux.go +++ b/internal/utils/service_linux.go @@ -4,13 +4,14 @@ package utils import ( "errors" + "os" + "os/exec" + "regexp" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/files" - "os" - "os/exec" - "regexp" ) var systemdServiceFile = "/etc/systemd/system/edge-admin.service" diff --git a/internal/utils/service_test.go b/internal/utils/service_test.go index 163a579f..35a26fd5 100644 --- a/internal/utils/service_test.go +++ b/internal/utils/service_test.go @@ -1,8 +1,9 @@ package utils import ( - teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "testing" + + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" ) func TestServiceManager_Log(t *testing.T) { diff --git a/internal/utils/service_windows.go b/internal/utils/service_windows.go index e82aa461..701f4d10 100644 --- a/internal/utils/service_windows.go +++ b/internal/utils/service_windows.go @@ -4,12 +4,13 @@ package utils import ( "fmt" + "os/exec" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/iwind/TeaGo/Tea" "golang.org/x/sys/windows" "golang.org/x/sys/windows/svc" "golang.org/x/sys/windows/svc/mgr" - "os/exec" ) // 安装服务 diff --git a/internal/utils/sizes/sizes_test.go b/internal/utils/sizes/sizes_test.go index b31876ba..31c03e96 100644 --- a/internal/utils/sizes/sizes_test.go +++ b/internal/utils/sizes/sizes_test.go @@ -3,9 +3,10 @@ package sizes_test import ( + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/sizes" "github.com/iwind/TeaGo/assert" - "testing" ) func TestSizes(t *testing.T) { diff --git a/internal/utils/strings.go b/internal/utils/strings.go index f9a0008e..adf40450 100644 --- a/internal/utils/strings.go +++ b/internal/utils/strings.go @@ -1,8 +1,9 @@ package utils import ( - "github.com/iwind/TeaGo/types" "strings" + + "github.com/iwind/TeaGo/types" ) // FormatAddress format address diff --git a/internal/utils/strings_stream.go b/internal/utils/strings_stream.go index 893ac2c7..fb982e70 100644 --- a/internal/utils/strings_stream.go +++ b/internal/utils/strings_stream.go @@ -1,10 +1,11 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils import ( - "github.com/iwind/TeaGo/lists" "strings" + + "github.com/iwind/TeaGo/lists" ) func FilterNotEmpty(item string) bool { diff --git a/internal/utils/strings_stream_test.go b/internal/utils/strings_stream_test.go index b6b91327..e269dcb2 100644 --- a/internal/utils/strings_stream_test.go +++ b/internal/utils/strings_stream_test.go @@ -1,11 +1,12 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils" "strings" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils" ) func TestStringsStream_Filter(t *testing.T) { diff --git a/internal/utils/taskutils/concurrent.go b/internal/utils/taskutils/concurrent.go index c4e8317c..8e67c443 100644 --- a/internal/utils/taskutils/concurrent.go +++ b/internal/utils/taskutils/concurrent.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package taskutils diff --git a/internal/utils/taskutils/concurrent_test.go b/internal/utils/taskutils/concurrent_test.go index 4726eb96..2c371e6b 100644 --- a/internal/utils/taskutils/concurrent_test.go +++ b/internal/utils/taskutils/concurrent_test.go @@ -1,10 +1,11 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package taskutils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils/taskutils" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils/taskutils" ) func TestRunConcurrent(t *testing.T) { diff --git a/internal/utils/time.go b/internal/utils/time.go index 9c44237f..b1349dba 100644 --- a/internal/utils/time.go +++ b/internal/utils/time.go @@ -1,12 +1,13 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils import ( "errors" "fmt" - "github.com/iwind/TeaGo/types" "regexp" + + "github.com/iwind/TeaGo/types" ) // RangeTimes 计算时间点 diff --git a/internal/utils/upgrade_manager.go b/internal/utils/upgrade_manager.go index 0babe6ea..8351da48 100644 --- a/internal/utils/upgrade_manager.go +++ b/internal/utils/upgrade_manager.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils @@ -8,12 +8,6 @@ import ( "encoding/json" "errors" "fmt" - teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" - executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" - "github.com/iwind/TeaGo/Tea" - "github.com/iwind/TeaGo/maps" - "github.com/iwind/TeaGo/types" - stringutil "github.com/iwind/TeaGo/utils/string" "io" "net/http" "os" @@ -22,6 +16,13 @@ import ( "runtime" "strings" "time" + + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" + executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" + "github.com/iwind/TeaGo/Tea" + "github.com/iwind/TeaGo/maps" + "github.com/iwind/TeaGo/types" + stringutil "github.com/iwind/TeaGo/utils/string" ) type UpgradeFileWriter struct { diff --git a/internal/utils/upgrade_manager_test.go b/internal/utils/upgrade_manager_test.go index 630e68e6..1892b741 100644 --- a/internal/utils/upgrade_manager_test.go +++ b/internal/utils/upgrade_manager_test.go @@ -1,11 +1,12 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/utils" "testing" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/utils" ) func TestNewUpgradeManager(t *testing.T) { diff --git a/internal/waf/injectionutils/utils_sqli.go b/internal/waf/injectionutils/utils_sqli.go index 8c66bd97..8bb7e23f 100644 --- a/internal/waf/injectionutils/utils_sqli.go +++ b/internal/waf/injectionutils/utils_sqli.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build gcc package injectionutils diff --git a/internal/waf/injectionutils/utils_sqli_stub.go b/internal/waf/injectionutils/utils_sqli_stub.go index f9558295..6c9dc269 100644 --- a/internal/waf/injectionutils/utils_sqli_stub.go +++ b/internal/waf/injectionutils/utils_sqli_stub.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !gcc package injectionutils diff --git a/internal/waf/injectionutils/utils_sqli_test.go b/internal/waf/injectionutils/utils_sqli_test.go index a3512aec..356d5774 100644 --- a/internal/waf/injectionutils/utils_sqli_test.go +++ b/internal/waf/injectionutils/utils_sqli_test.go @@ -1,16 +1,17 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build gcc package injectionutils_test import ( + "runtime" + "strings" + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/waf/injectionutils" "github.com/iwind/TeaGo/assert" "github.com/iwind/TeaGo/rands" "github.com/iwind/TeaGo/types" - "runtime" - "strings" - "testing" ) func TestDetectSQLInjection(t *testing.T) { diff --git a/internal/waf/injectionutils/utils_xss.go b/internal/waf/injectionutils/utils_xss.go index abcd3343..27f3bffd 100644 --- a/internal/waf/injectionutils/utils_xss.go +++ b/internal/waf/injectionutils/utils_xss.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build gcc package injectionutils @@ -11,11 +11,12 @@ package injectionutils */ import "C" import ( - "github.com/cespare/xxhash/v2" "net/url" "strconv" "strings" "unsafe" + + "github.com/cespare/xxhash/v2" ) const MaxCacheDataSize = 1 << 20 diff --git a/internal/waf/injectionutils/utils_xss_stub.go b/internal/waf/injectionutils/utils_xss_stub.go index 76a3dcb0..4fc6da12 100644 --- a/internal/waf/injectionutils/utils_xss_stub.go +++ b/internal/waf/injectionutils/utils_xss_stub.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !gcc package injectionutils diff --git a/internal/waf/injectionutils/utils_xss_test.go b/internal/waf/injectionutils/utils_xss_test.go index 8051d700..5a36812d 100644 --- a/internal/waf/injectionutils/utils_xss_test.go +++ b/internal/waf/injectionutils/utils_xss_test.go @@ -1,13 +1,14 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build gcc package injectionutils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/waf/injectionutils" - "github.com/iwind/TeaGo/assert" "runtime" "testing" + + "github.com/TeaOSLab/EdgeAdmin/internal/waf/injectionutils" + "github.com/iwind/TeaGo/assert" ) func TestDetectXSS(t *testing.T) { diff --git a/internal/web/actions/actionutils/action_interface.go b/internal/web/actions/actionutils/action_interface.go index 83bdb8a0..e432afd6 100644 --- a/internal/web/actions/actionutils/action_interface.go +++ b/internal/web/actions/actionutils/action_interface.go @@ -2,6 +2,7 @@ package actionutils import ( "context" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/iwind/TeaGo/maps" ) diff --git a/internal/web/actions/actionutils/csrf.go b/internal/web/actions/actionutils/csrf.go index 33934517..6af2a1fc 100644 --- a/internal/web/actions/actionutils/csrf.go +++ b/internal/web/actions/actionutils/csrf.go @@ -1,9 +1,10 @@ package actionutils import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/csrf" "github.com/iwind/TeaGo/actions" - "net/http" ) type CSRF struct { diff --git a/internal/web/actions/actionutils/page.go b/internal/web/actions/actionutils/page.go index 317fc5c1..67df83b1 100644 --- a/internal/web/actions/actionutils/page.go +++ b/internal/web/actions/actionutils/page.go @@ -2,10 +2,11 @@ package actionutils import ( "fmt" - "github.com/iwind/TeaGo/actions" "math" "net/url" "strings" + + "github.com/iwind/TeaGo/actions" ) type Page struct { diff --git a/internal/web/actions/actionutils/parent_action.go b/internal/web/actions/actionutils/parent_action.go index 6bfabf6e..16c1142f 100644 --- a/internal/web/actions/actionutils/parent_action.go +++ b/internal/web/actions/actionutils/parent_action.go @@ -4,6 +4,9 @@ import ( "context" "errors" "fmt" + "net/http" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" @@ -16,8 +19,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" - "net/http" - "strconv" ) type ParentAction struct { diff --git a/internal/web/actions/actionutils/utils.go b/internal/web/actions/actionutils/utils.go index cfa0a63e..ab2d1750 100644 --- a/internal/web/actions/actionutils/utils.go +++ b/internal/web/actions/actionutils/utils.go @@ -4,6 +4,15 @@ import ( "encoding/json" "errors" "fmt" + "net" + "net/http" + "os" + "path/filepath" + "reflect" + "runtime" + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -13,14 +22,6 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/gosock/pkg/gosock" - "net" - "net/http" - "os" - "path/filepath" - "reflect" - "runtime" - "strings" - "time" ) // Fail 提示服务器错误信息 diff --git a/internal/web/actions/default/admins/admin.go b/internal/web/actions/default/admins/admin.go index 76ca836a..f2502648 100644 --- a/internal/web/actions/default/admins/admin.go +++ b/internal/web/actions/default/admins/admin.go @@ -2,6 +2,7 @@ package admins import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/admins/adminutils/utils.go b/internal/web/actions/default/admins/adminutils/utils.go index c078bbb9..947b99d6 100644 --- a/internal/web/actions/default/admins/adminutils/utils.go +++ b/internal/web/actions/default/admins/adminutils/utils.go @@ -2,6 +2,7 @@ package adminutils import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" diff --git a/internal/web/actions/default/admins/createPopup.go b/internal/web/actions/default/admins/createPopup.go index f1a30207..2dd00738 100644 --- a/internal/web/actions/default/admins/createPopup.go +++ b/internal/web/actions/default/admins/createPopup.go @@ -2,6 +2,7 @@ package admins import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/admins/otpQrcode.go b/internal/web/actions/default/admins/otpQrcode.go index 2688ae16..b53d27d9 100644 --- a/internal/web/actions/default/admins/otpQrcode.go +++ b/internal/web/actions/default/admins/otpQrcode.go @@ -2,6 +2,7 @@ package admins import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" diff --git a/internal/web/actions/default/admins/update.go b/internal/web/actions/default/admins/update.go index 6b09c62b..eec40c14 100644 --- a/internal/web/actions/default/admins/update.go +++ b/internal/web/actions/default/admins/update.go @@ -2,6 +2,7 @@ package admins import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/clusters/cluster/createBatch.go b/internal/web/actions/default/clusters/cluster/createBatch.go index 7b004692..5a661539 100644 --- a/internal/web/actions/default/clusters/cluster/createBatch.go +++ b/internal/web/actions/default/clusters/cluster/createBatch.go @@ -1,6 +1,10 @@ package cluster import ( + "net" + "strconv" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" @@ -8,9 +12,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "net" - "strconv" - "strings" ) type CreateBatchAction struct { diff --git a/internal/web/actions/default/clusters/cluster/createBatch_ext.go b/internal/web/actions/default/clusters/cluster/createBatch_ext.go index 59a4bd79..1ad23219 100644 --- a/internal/web/actions/default/clusters/cluster/createBatch_ext.go +++ b/internal/web/actions/default/clusters/cluster/createBatch_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package cluster diff --git a/internal/web/actions/default/clusters/cluster/createNode.go b/internal/web/actions/default/clusters/cluster/createNode.go index 765fbd66..09048279 100644 --- a/internal/web/actions/default/clusters/cluster/createNode.go +++ b/internal/web/actions/default/clusters/cluster/createNode.go @@ -2,6 +2,11 @@ package cluster import ( "encoding/json" + "net" + "regexp" + "strconv" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/clusterutils" @@ -11,10 +16,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" - "regexp" - "strconv" - "strings" ) // CreateNodeAction 创建节点 @@ -124,6 +125,8 @@ func (this *CreateNodeAction) RunPost(params struct { DnsDomainId int64 DnsRoutesJSON []byte + SecondaryClusterIds []byte + Must *actions.Must }) { params.Must. @@ -342,5 +345,30 @@ func (this *CreateNodeAction) RunPost(params struct { } } + var secondaryClusterIds = []int64{} + if len(params.SecondaryClusterIds) > 0 { + err := json.Unmarshal(params.SecondaryClusterIds, &secondaryClusterIds) + if err != nil { + this.ErrorPage(err) + return + } + } + + _, err = this.RPC().NodeRPC().UpdateNode(this.AdminContext(), &pb.UpdateNodeRequest{ + NodeId: nodeResp.Node.Id, + NodeGroupId: params.GroupId, + NodeRegionId: params.RegionId, + Name: nodeResp.Node.Name, + NodeClusterId: params.ClusterId, + SecondaryNodeClusterIds: secondaryClusterIds, + IsOn: true, + Level: nodeResp.Node.Level, + LnAddrs: nodeResp.Node.LnAddrs, + EnableIPLists: nodeResp.Node.EnableIPLists, + }) + if err != nil { + this.ErrorPage(err) + return + } this.Success() } diff --git a/internal/web/actions/default/clusters/cluster/createNode_ext.go b/internal/web/actions/default/clusters/cluster/createNode_ext.go index d0e08006..fb6bb501 100644 --- a/internal/web/actions/default/clusters/cluster/createNode_ext.go +++ b/internal/web/actions/default/clusters/cluster/createNode_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package cluster diff --git a/internal/web/actions/default/clusters/cluster/downloadInstaller.go b/internal/web/actions/default/clusters/cluster/downloadInstaller.go index 44407955..01ab0b54 100644 --- a/internal/web/actions/default/clusters/cluster/downloadInstaller.go +++ b/internal/web/actions/default/clusters/cluster/downloadInstaller.go @@ -1,15 +1,16 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cluster import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/iwind/TeaGo/Tea" - "github.com/iwind/TeaGo/types" "io" "net/http" "os" "regexp" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/Tea" + "github.com/iwind/TeaGo/types" ) type DownloadInstallerAction struct { diff --git a/internal/web/actions/default/clusters/cluster/index.go b/internal/web/actions/default/clusters/cluster/index.go index fae6c9c5..4105f6fc 100644 --- a/internal/web/actions/default/clusters/cluster/index.go +++ b/internal/web/actions/default/clusters/cluster/index.go @@ -3,9 +3,10 @@ package cluster import ( + "strconv" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "strconv" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/installManual.go b/internal/web/actions/default/clusters/cluster/installManual.go index f3169724..35354e17 100644 --- a/internal/web/actions/default/clusters/cluster/installManual.go +++ b/internal/web/actions/default/clusters/cluster/installManual.go @@ -2,6 +2,7 @@ package cluster import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" diff --git a/internal/web/actions/default/clusters/cluster/installNodes.go b/internal/web/actions/default/clusters/cluster/installNodes.go index b0c56e73..e6f0e73f 100644 --- a/internal/web/actions/default/clusters/cluster/installNodes.go +++ b/internal/web/actions/default/clusters/cluster/installNodes.go @@ -1,10 +1,11 @@ package cluster import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "strings" ) type InstallNodesAction struct { diff --git a/internal/web/actions/default/clusters/cluster/installRemote.go b/internal/web/actions/default/clusters/cluster/installRemote.go index 448b6b79..756c80d1 100644 --- a/internal/web/actions/default/clusters/cluster/installRemote.go +++ b/internal/web/actions/default/clusters/cluster/installRemote.go @@ -2,6 +2,7 @@ package cluster import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/clusters/cluster/node/detail.go b/internal/web/actions/default/clusters/cluster/node/detail.go index 96b31788..2a5e9311 100644 --- a/internal/web/actions/default/clusters/cluster/node/detail.go +++ b/internal/web/actions/default/clusters/cluster/node/detail.go @@ -3,6 +3,8 @@ package node import ( "encoding/json" "fmt" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" @@ -13,7 +15,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type DetailAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/index.go b/internal/web/actions/default/clusters/cluster/node/index.go index d5fe950f..b8834f67 100644 --- a/internal/web/actions/default/clusters/cluster/node/index.go +++ b/internal/web/actions/default/clusters/cluster/node/index.go @@ -2,10 +2,11 @@ package node import ( "fmt" + "strconv" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" - "strconv" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/install.go b/internal/web/actions/default/clusters/cluster/node/install.go index e8c61270..168345ed 100644 --- a/internal/web/actions/default/clusters/cluster/node/install.go +++ b/internal/web/actions/default/clusters/cluster/node/install.go @@ -2,6 +2,9 @@ package node import ( "encoding/json" + "path/filepath" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" @@ -12,8 +15,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "path/filepath" - "strings" ) // InstallAction 安装节点 diff --git a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go index 29c5df23..bc5060c9 100644 --- a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go +++ b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go @@ -4,12 +4,13 @@ package nodeutils import ( "errors" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strconv" ) // InitNodeInfo 初始化节点信息 @@ -38,12 +39,13 @@ func InitNodeInfo(parentAction *actionutils.ParentAction, nodeId int64) (*pb.Nod } parentAction.Data["node"] = maps.Map{ - "id": node.Id, - "name": node.Name, - "isOn": node.IsOn, - "isUp": node.IsUp, - "group": groupMap, - "level": node.Level, + "id": node.Id, + "name": node.Name, + "isOn": node.IsOn, + "isUp": node.IsUp, + "group": groupMap, + "level": node.Level, + "bypassMobile": node.BypassMobile, } var clusterId int64 = 0 if node.NodeCluster != nil { diff --git a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_ext.go b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_ext.go index 35e9e458..c2c82a02 100644 --- a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_ext.go +++ b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package nodeutils diff --git a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_test.go b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_test.go index 3a771684..57b0d00f 100644 --- a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_test.go +++ b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils_test.go @@ -1,16 +1,16 @@ -// 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 nodeutils_test import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" - _ "github.com/iwind/TeaGo/bootstrap" "testing" + + _ "github.com/iwind/TeaGo/bootstrap" ) func TestInstallLocalNode(t *testing.T) { - err := nodeutils.InstallLocalNode() - if err != nil { - t.Fatal(err) - } + // err := nodeutils.InstallLocalNode() + // if err != nil { + // t.Fatal(err) + // } } diff --git a/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go b/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go index b0d49955..011c9a62 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go @@ -4,6 +4,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/clusters/cluster/node/settings/ddos-protection/index.go b/internal/web/actions/default/clusters/cluster/node/settings/ddos-protection/index.go index 58b53357..c7761ec5 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/ddos-protection/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/ddos-protection/index.go @@ -4,6 +4,8 @@ package ddosProtection import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -12,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "net" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/settings/dns/index.go b/internal/web/actions/default/clusters/cluster/node/settings/dns/index.go index a077a05b..725df956 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/dns/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/dns/index.go @@ -4,6 +4,7 @@ package dns import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/clusters/cluster/node/settings/ssh/index.go b/internal/web/actions/default/clusters/cluster/node/settings/ssh/index.go index 0bcbfe92..facbb988 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/ssh/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/ssh/index.go @@ -4,6 +4,9 @@ package ssh import ( "encoding/json" + "net" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" @@ -11,8 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/settings/system/index.go b/internal/web/actions/default/clusters/cluster/node/settings/system/index.go index cb8a7f0c..cceebcc6 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/system/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/system/index.go @@ -4,6 +4,7 @@ package system import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -35,6 +36,8 @@ func (this *IndexAction) RunGet(params struct { // 获取节点信息 var nodeMap = this.Data["node"].(maps.Map) nodeMap["maxCPU"] = node.MaxCPU + nodeMap["bypassMobileCheckbox"] = node.BypassMobile > 0 + nodeMap["bypassMobile"] = node.BypassMobile // DNS dnsResolverResp, err := this.RPC().NodeRPC().FindNodeDNSResolver(this.AdminContext(), &pb.FindNodeDNSResolverRequest{NodeId: params.NodeId}) @@ -75,6 +78,8 @@ func (this *IndexAction) RunPost(params struct { NodeId int64 MaxCPU int32 + BypassMobile int32 + DnsResolverJSON []byte ApiNodeAddrsJSON []byte @@ -98,6 +103,16 @@ func (this *IndexAction) RunPost(params struct { return } + // bypass 移动 + _, err = this.RPC().NodeRPC().UpdateNodeBypassMobile(this.AdminContext(), &pb.UpdateNodeBypassMobile{ + NodeId: params.NodeId, + BypassMobile: params.BypassMobile, + }) + if err != nil { + this.ErrorPage(err) + return + } + // DNS解析设置 var dnsResolverConfig = nodeconfigs.DefaultDNSResolverConfig() err = json.Unmarshal(params.DnsResolverJSON, dnsResolverConfig) diff --git a/internal/web/actions/default/clusters/cluster/node/uninstall.go b/internal/web/actions/default/clusters/cluster/node/uninstall.go index 0bd23fc3..0930c488 100644 --- a/internal/web/actions/default/clusters/cluster/node/uninstall.go +++ b/internal/web/actions/default/clusters/cluster/node/uninstall.go @@ -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 node diff --git a/internal/web/actions/default/clusters/cluster/node/update.go b/internal/web/actions/default/clusters/cluster/node/update.go index 726ba931..2d509fe0 100644 --- a/internal/web/actions/default/clusters/cluster/node/update.go +++ b/internal/web/actions/default/clusters/cluster/node/update.go @@ -2,6 +2,8 @@ package node import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/ipAddresses/ipaddressutils" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net" ) type UpdateAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/updateDNSPopup.go b/internal/web/actions/default/clusters/cluster/node/updateDNSPopup.go index 97cb0cd4..1ff83372 100644 --- a/internal/web/actions/default/clusters/cluster/node/updateDNSPopup.go +++ b/internal/web/actions/default/clusters/cluster/node/updateDNSPopup.go @@ -2,13 +2,14 @@ package node import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" ) type UpdateDNSPopupAction struct { diff --git a/internal/web/actions/default/clusters/cluster/node/updateIsOn.go b/internal/web/actions/default/clusters/cluster/node/updateIsOn.go index 7f889a56..90bbfd40 100644 --- a/internal/web/actions/default/clusters/cluster/node/updateIsOn.go +++ b/internal/web/actions/default/clusters/cluster/node/updateIsOn.go @@ -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 node diff --git a/internal/web/actions/default/clusters/cluster/nodes.go b/internal/web/actions/default/clusters/cluster/nodes.go index d0eca893..d34623b2 100644 --- a/internal/web/actions/default/clusters/cluster/nodes.go +++ b/internal/web/actions/default/clusters/cluster/nodes.go @@ -3,6 +3,8 @@ package cluster import ( "encoding/json" "fmt" + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -12,7 +14,6 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "time" ) type NodesAction struct { diff --git a/internal/web/actions/default/clusters/cluster/settings/ddos-protection/index.go b/internal/web/actions/default/clusters/cluster/settings/ddos-protection/index.go index 531c68e7..67bac8d0 100644 --- a/internal/web/actions/default/clusters/cluster/settings/ddos-protection/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/ddos-protection/index.go @@ -4,6 +4,8 @@ package ddosProtection import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" @@ -11,7 +13,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "net" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/settings/ddos-protection/status.go b/internal/web/actions/default/clusters/cluster/settings/ddos-protection/status.go index 2ed6e2ac..aec3409c 100644 --- a/internal/web/actions/default/clusters/cluster/settings/ddos-protection/status.go +++ b/internal/web/actions/default/clusters/cluster/settings/ddos-protection/status.go @@ -4,6 +4,7 @@ package ddosProtection import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/messageconfigs" diff --git a/internal/web/actions/default/clusters/cluster/settings/dns/records.go b/internal/web/actions/default/clusters/cluster/settings/dns/records.go index e4b5c3af..b5bc6d78 100644 --- a/internal/web/actions/default/clusters/cluster/settings/dns/records.go +++ b/internal/web/actions/default/clusters/cluster/settings/dns/records.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package dns diff --git a/internal/web/actions/default/clusters/cluster/settings/firewall-actions/createPopup.go b/internal/web/actions/default/clusters/cluster/settings/firewall-actions/createPopup.go index 40ce70fe..94e3157c 100644 --- a/internal/web/actions/default/clusters/cluster/settings/firewall-actions/createPopup.go +++ b/internal/web/actions/default/clusters/cluster/settings/firewall-actions/createPopup.go @@ -2,6 +2,7 @@ package firewallActions import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/clusters/cluster/settings/firewall-actions/updatePopup.go b/internal/web/actions/default/clusters/cluster/settings/firewall-actions/updatePopup.go index b3fb93f0..b638cbf2 100644 --- a/internal/web/actions/default/clusters/cluster/settings/firewall-actions/updatePopup.go +++ b/internal/web/actions/default/clusters/cluster/settings/firewall-actions/updatePopup.go @@ -2,6 +2,7 @@ package firewallActions import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/clusters/cluster/settings/global-server-config/index.go b/internal/web/actions/default/clusters/cluster/settings/global-server-config/index.go index a01e0d25..f6edf5f6 100644 --- a/internal/web/actions/default/clusters/cluster/settings/global-server-config/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/global-server-config/index.go @@ -1,9 +1,11 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package globalServerConfig import ( "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/clusters/cluster/settings/health/checkDomain.go b/internal/web/actions/default/clusters/cluster/settings/health/checkDomain.go index d14a514b..7c576496 100644 --- a/internal/web/actions/default/clusters/cluster/settings/health/checkDomain.go +++ b/internal/web/actions/default/clusters/cluster/settings/health/checkDomain.go @@ -1,12 +1,13 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package health import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "net" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" ) type CheckDomainAction struct { diff --git a/internal/web/actions/default/clusters/cluster/settings/health/index.go b/internal/web/actions/default/clusters/cluster/settings/health/index.go index b2d6bd1d..2aa31120 100644 --- a/internal/web/actions/default/clusters/cluster/settings/health/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/health/index.go @@ -2,6 +2,7 @@ package health import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/clusters/cluster/settings/index.go b/internal/web/actions/default/clusters/cluster/settings/index.go index 6a0f3aa8..101bb37f 100644 --- a/internal/web/actions/default/clusters/cluster/settings/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/index.go @@ -2,6 +2,7 @@ package settings import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/clusters/cluster/settings/services/index.go b/internal/web/actions/default/clusters/cluster/settings/services/index.go index c29b801f..827cc0b0 100644 --- a/internal/web/actions/default/clusters/cluster/settings/services/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/services/index.go @@ -2,6 +2,7 @@ package services import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" diff --git a/internal/web/actions/default/clusters/cluster/settings/webp/index.go b/internal/web/actions/default/clusters/cluster/settings/webp/index.go index cd2e7c93..bd514161 100644 --- a/internal/web/actions/default/clusters/cluster/settings/webp/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/webp/index.go @@ -2,6 +2,7 @@ package webp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" diff --git a/internal/web/actions/default/clusters/cluster/updateNodeSSH.go b/internal/web/actions/default/clusters/cluster/updateNodeSSH.go index d7bad381..c0b2d367 100644 --- a/internal/web/actions/default/clusters/cluster/updateNodeSSH.go +++ b/internal/web/actions/default/clusters/cluster/updateNodeSSH.go @@ -2,14 +2,15 @@ package cluster import ( "encoding/json" + "net" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" - "regexp" ) type UpdateNodeSSHAction struct { diff --git a/internal/web/actions/default/clusters/cluster/upgradeRemote.go b/internal/web/actions/default/clusters/cluster/upgradeRemote.go index a3e3907a..cd1c9c5a 100644 --- a/internal/web/actions/default/clusters/cluster/upgradeRemote.go +++ b/internal/web/actions/default/clusters/cluster/upgradeRemote.go @@ -2,6 +2,7 @@ package cluster import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/clusters/cluster/utils.go b/internal/web/actions/default/clusters/cluster/utils.go index fb6ee271..09205f6c 100644 --- a/internal/web/actions/default/clusters/cluster/utils.go +++ b/internal/web/actions/default/clusters/cluster/utils.go @@ -2,6 +2,7 @@ package cluster import ( "context" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs" diff --git a/internal/web/actions/default/clusters/clusterutils/cluster_helper.go b/internal/web/actions/default/clusters/clusterutils/cluster_helper.go index 49238fcf..2cf39387 100644 --- a/internal/web/actions/default/clusters/clusterutils/cluster_helper.go +++ b/internal/web/actions/default/clusters/clusterutils/cluster_helper.go @@ -1,6 +1,9 @@ package clusterutils import ( + "net/http" + "strconv" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -11,8 +14,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" - "net/http" - "strconv" ) // ClusterHelper 单个集群的帮助 diff --git a/internal/web/actions/default/clusters/clusterutils/cluster_helper_ext.go b/internal/web/actions/default/clusters/clusterutils/cluster_helper_ext.go index dd1acbe0..05ad13a3 100644 --- a/internal/web/actions/default/clusters/clusterutils/cluster_helper_ext.go +++ b/internal/web/actions/default/clusters/clusterutils/cluster_helper_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package clusterutils diff --git a/internal/web/actions/default/clusters/clusterutils/clusters_helper.go b/internal/web/actions/default/clusters/clusterutils/clusters_helper.go index 22bf4344..a11d345a 100644 --- a/internal/web/actions/default/clusters/clusterutils/clusters_helper.go +++ b/internal/web/actions/default/clusters/clusterutils/clusters_helper.go @@ -1,8 +1,9 @@ package clusterutils import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type ClustersHelper struct { diff --git a/internal/web/actions/default/clusters/clusterutils/installer.go b/internal/web/actions/default/clusters/clusterutils/installer.go index ce0bb161..f7408e61 100644 --- a/internal/web/actions/default/clusters/clusterutils/installer.go +++ b/internal/web/actions/default/clusters/clusterutils/installer.go @@ -1,14 +1,15 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package clusterutils import ( - teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" - "github.com/iwind/TeaGo/Tea" "path/filepath" "regexp" "sort" "strings" + + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" + "github.com/iwind/TeaGo/Tea" ) type installerFile struct { diff --git a/internal/web/actions/default/clusters/create.go b/internal/web/actions/default/clusters/create.go index 0caf3852..a0916813 100644 --- a/internal/web/actions/default/clusters/create.go +++ b/internal/web/actions/default/clusters/create.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "encoding/json" "fmt" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/clusters/createNode.go b/internal/web/actions/default/clusters/createNode.go index a791803d..87f6432c 100644 --- a/internal/web/actions/default/clusters/createNode.go +++ b/internal/web/actions/default/clusters/createNode.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package clusters diff --git a/internal/web/actions/default/clusters/grants/grant.go b/internal/web/actions/default/clusters/grants/grant.go index 55725b82..6ca4874a 100644 --- a/internal/web/actions/default/clusters/grants/grant.go +++ b/internal/web/actions/default/clusters/grants/grant.go @@ -1,11 +1,12 @@ package grants import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "strings" ) type GrantAction struct { diff --git a/internal/web/actions/default/clusters/grants/test.go b/internal/web/actions/default/clusters/grants/test.go index ad1df1e3..468db1db 100644 --- a/internal/web/actions/default/clusters/grants/test.go +++ b/internal/web/actions/default/clusters/grants/test.go @@ -3,12 +3,13 @@ package grants import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type TestAction struct { diff --git a/internal/web/actions/default/clusters/grants/update.go b/internal/web/actions/default/clusters/grants/update.go index 8ca0c997..140dbfe2 100644 --- a/internal/web/actions/default/clusters/grants/update.go +++ b/internal/web/actions/default/clusters/grants/update.go @@ -1,6 +1,8 @@ package grants import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -8,7 +10,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "golang.org/x/crypto/ssh" - "strings" ) type UpdateAction struct { diff --git a/internal/web/actions/default/clusters/logs/deleteAll.go b/internal/web/actions/default/clusters/logs/deleteAll.go index a649cae9..22497d41 100644 --- a/internal/web/actions/default/clusters/logs/deleteAll.go +++ b/internal/web/actions/default/clusters/logs/deleteAll.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package logs diff --git a/internal/web/actions/default/clusters/logs/fix.go b/internal/web/actions/default/clusters/logs/fix.go index 10374661..218d8d62 100644 --- a/internal/web/actions/default/clusters/logs/fix.go +++ b/internal/web/actions/default/clusters/logs/fix.go @@ -3,12 +3,13 @@ package logs import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/types" - "strings" ) type FixAction struct { diff --git a/internal/web/actions/default/clusters/nodes.go b/internal/web/actions/default/clusters/nodes.go index 48b6e8f3..47d1aba1 100644 --- a/internal/web/actions/default/clusters/nodes.go +++ b/internal/web/actions/default/clusters/nodes.go @@ -4,6 +4,9 @@ package clusters import ( "encoding/json" + "strconv" + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -12,8 +15,6 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strconv" - "time" ) type NodesAction struct { diff --git a/internal/web/actions/default/clusters/regions/nodes.go b/internal/web/actions/default/clusters/regions/nodes.go index 23655958..fa6948bc 100644 --- a/internal/web/actions/default/clusters/regions/nodes.go +++ b/internal/web/actions/default/clusters/regions/nodes.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package regions diff --git a/internal/web/actions/default/clusters/regions/updateNodeRegionPopup.go b/internal/web/actions/default/clusters/regions/updateNodeRegionPopup.go index fff8f52e..0f88a846 100644 --- a/internal/web/actions/default/clusters/regions/updateNodeRegionPopup.go +++ b/internal/web/actions/default/clusters/regions/updateNodeRegionPopup.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package regions diff --git a/internal/web/actions/default/clusters/tasks/check.go b/internal/web/actions/default/clusters/tasks/check.go index ad221951..8b7ea735 100644 --- a/internal/web/actions/default/clusters/tasks/check.go +++ b/internal/web/actions/default/clusters/tasks/check.go @@ -1,9 +1,10 @@ package tasks import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "time" ) type CheckAction struct { diff --git a/internal/web/actions/default/clusters/tasks/deleteAll.go b/internal/web/actions/default/clusters/tasks/deleteAll.go index 746109a9..f0623996 100644 --- a/internal/web/actions/default/clusters/tasks/deleteAll.go +++ b/internal/web/actions/default/clusters/tasks/deleteAll.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package tasks diff --git a/internal/web/actions/default/csrf/token.go b/internal/web/actions/default/csrf/token.go index 67a117ae..d41efe2b 100644 --- a/internal/web/actions/default/csrf/token.go +++ b/internal/web/actions/default/csrf/token.go @@ -1,11 +1,12 @@ package csrf import ( + "sync" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/csrf" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" - "sync" - "time" ) var lastTimestamp = int64(0) diff --git a/internal/web/actions/default/dashboard/dashboardutils/utils.go b/internal/web/actions/default/dashboard/dashboardutils/utils.go index 553deaca..baf226b1 100644 --- a/internal/web/actions/default/dashboard/dashboardutils/utils.go +++ b/internal/web/actions/default/dashboard/dashboardutils/utils.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package dashboardutils @@ -6,6 +6,12 @@ import ( "bytes" "context" "encoding/json" + "os" + "os/exec" + "regexp" + "runtime" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" @@ -14,11 +20,6 @@ import ( "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" "github.com/shirou/gopsutil/v3/disk" - "os" - "os/exec" - "regexp" - "runtime" - "strings" ) // CheckDiskPartitions 检查服务器硬盘空间 diff --git a/internal/web/actions/default/dashboard/index.go b/internal/web/actions/default/dashboard/index.go index 9e2bf7db..540b2a4d 100644 --- a/internal/web/actions/default/dashboard/index.go +++ b/internal/web/actions/default/dashboard/index.go @@ -3,6 +3,8 @@ package dashboard import ( + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" @@ -13,7 +15,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/maps" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/dashboard/index_ext.go b/internal/web/actions/default/dashboard/index_ext.go index 811e0430..cc9bd981 100644 --- a/internal/web/actions/default/dashboard/index_ext.go +++ b/internal/web/actions/default/dashboard/index_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package dashboard diff --git a/internal/web/actions/default/dashboard/restartLocalAPINode.go b/internal/web/actions/default/dashboard/restartLocalAPINode.go index 628955b1..6d856466 100644 --- a/internal/web/actions/default/dashboard/restartLocalAPINode.go +++ b/internal/web/actions/default/dashboard/restartLocalAPINode.go @@ -1,14 +1,15 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package dashboard import ( "bytes" - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "os/exec" "regexp" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" ) type RestartLocalAPINodeAction struct { diff --git a/internal/web/actions/default/db/dbnodeutils/utils.go b/internal/web/actions/default/db/dbnodeutils/utils.go index 3ac3d64f..c37c53cc 100644 --- a/internal/web/actions/default/db/dbnodeutils/utils.go +++ b/internal/web/actions/default/db/dbnodeutils/utils.go @@ -4,6 +4,7 @@ package dbnodeutils import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/db/helper.go b/internal/web/actions/default/db/helper.go index 815ed01a..18d8f9a2 100644 --- a/internal/web/actions/default/db/helper.go +++ b/internal/web/actions/default/db/helper.go @@ -1,11 +1,12 @@ package db import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/iwind/TeaGo/actions" - "net/http" ) type Helper struct { diff --git a/internal/web/actions/default/db/node.go b/internal/web/actions/default/db/node.go index 5dc739c8..411e9ba3 100644 --- a/internal/web/actions/default/db/node.go +++ b/internal/web/actions/default/db/node.go @@ -3,10 +3,11 @@ package db import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/db/dbnodeutils" "github.com/iwind/TeaGo/maps" - "strings" ) type NodeAction struct { diff --git a/internal/web/actions/default/dns/domainOptions.go b/internal/web/actions/default/dns/domainOptions.go index d3012570..2ff13088 100644 --- a/internal/web/actions/default/dns/domainOptions.go +++ b/internal/web/actions/default/dns/domainOptions.go @@ -1,10 +1,11 @@ package dns import ( + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "sort" ) // DomainOptionsAction 域名列表选项 diff --git a/internal/web/actions/default/dns/domains/createPopup.go b/internal/web/actions/default/dns/domains/createPopup.go index 6ebbb336..08d86bd9 100644 --- a/internal/web/actions/default/dns/domains/createPopup.go +++ b/internal/web/actions/default/dns/domains/createPopup.go @@ -1,12 +1,13 @@ package domains import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" - "strings" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/dns/domains/domainutils/utils.go b/internal/web/actions/default/dns/domains/domainutils/utils.go index 876e8560..03093406 100644 --- a/internal/web/actions/default/dns/domains/domainutils/utils.go +++ b/internal/web/actions/default/dns/domains/domainutils/utils.go @@ -1,13 +1,14 @@ package domainutils import ( + "net" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "net" - "regexp" - "strings" ) // ValidateDomainFormat 校验域名格式 diff --git a/internal/web/actions/default/dns/domains/domainutils/utils_test.go b/internal/web/actions/default/dns/domains/domainutils/utils_test.go index 60eb3cd9..6820dd28 100644 --- a/internal/web/actions/default/dns/domains/domainutils/utils_test.go +++ b/internal/web/actions/default/dns/domains/domainutils/utils_test.go @@ -3,9 +3,10 @@ package domainutils import ( + "testing" + "github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs" "github.com/iwind/TeaGo/assert" - "testing" ) func TestValidateRecordValue(t *testing.T) { diff --git a/internal/web/actions/default/dns/domains/updatePopup.go b/internal/web/actions/default/dns/domains/updatePopup.go index 36262200..5a1f039a 100644 --- a/internal/web/actions/default/dns/domains/updatePopup.go +++ b/internal/web/actions/default/dns/domains/updatePopup.go @@ -1,12 +1,14 @@ package domains -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type UpdatePopupAction struct { diff --git a/internal/web/actions/default/dns/helper.go b/internal/web/actions/default/dns/helper.go index 9b7cdcf1..f17e17c9 100644 --- a/internal/web/actions/default/dns/helper.go +++ b/internal/web/actions/default/dns/helper.go @@ -1,8 +1,9 @@ package dns import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type Helper struct { diff --git a/internal/web/actions/default/dns/issues/updateNodePopup.go b/internal/web/actions/default/dns/issues/updateNodePopup.go index 38ce583f..dddca080 100644 --- a/internal/web/actions/default/dns/issues/updateNodePopup.go +++ b/internal/web/actions/default/dns/issues/updateNodePopup.go @@ -2,13 +2,14 @@ package issues import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" ) type UpdateNodePopupAction struct { diff --git a/internal/web/actions/default/dns/providers/createPopup.go b/internal/web/actions/default/dns/providers/createPopup.go index cced70a2..aa687c4c 100644 --- a/internal/web/actions/default/dns/providers/createPopup.go +++ b/internal/web/actions/default/dns/providers/createPopup.go @@ -84,6 +84,10 @@ func (this *CreatePopupAction) RunPost(params struct { ParamEdgeDNSAPIAccessKeyId string ParamEdgeDNSAPIAccessKeySecret string + // DNS.LA + ParamDNSLaAPIId string + ParamDNSLaSecret string + MinTTL int32 Must *actions.Must @@ -171,6 +175,15 @@ func (this *CreatePopupAction) RunPost(params struct { Require("请输入私钥") apiParams["url"] = params.ParamCustomHTTPURL apiParams["secret"] = params.ParamCustomHTTPSecret + case "dnsla": + params.Must. + Field("paramDNSLaAPIId", params.ParamDNSLaAPIId). + Require("请输入API ID"). + Field("paramDNSLaSecret", params.ParamDNSLaSecret). + Require("请输入API密钥") + + apiParams["apiId"] = params.ParamDNSLaAPIId + apiParams["secret"] = params.ParamDNSLaSecret default: this.Fail("暂时不支持此服务商'" + params.Type + "'") } diff --git a/internal/web/actions/default/dns/providers/index.go b/internal/web/actions/default/dns/providers/index.go index b1d2eb0d..f00a9d26 100644 --- a/internal/web/actions/default/dns/providers/index.go +++ b/internal/web/actions/default/dns/providers/index.go @@ -1,12 +1,13 @@ package providers import ( + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "regexp" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/dns/providers/provider.go b/internal/web/actions/default/dns/providers/provider.go index 0067990d..1959c331 100644 --- a/internal/web/actions/default/dns/providers/provider.go +++ b/internal/web/actions/default/dns/providers/provider.go @@ -2,6 +2,7 @@ package providers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" diff --git a/internal/web/actions/default/dns/providers/provider_ext.go b/internal/web/actions/default/dns/providers/provider_ext.go index b281c057..69816f49 100644 --- a/internal/web/actions/default/dns/providers/provider_ext.go +++ b/internal/web/actions/default/dns/providers/provider_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package providers diff --git a/internal/web/actions/default/dns/providers/updatePopup.go b/internal/web/actions/default/dns/providers/updatePopup.go index 47e4165a..4fdad8c3 100644 --- a/internal/web/actions/default/dns/providers/updatePopup.go +++ b/internal/web/actions/default/dns/providers/updatePopup.go @@ -4,6 +4,7 @@ package providers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/dns/tasks/check.go b/internal/web/actions/default/dns/tasks/check.go index 6cf86ee0..c866aa60 100644 --- a/internal/web/actions/default/dns/tasks/check.go +++ b/internal/web/actions/default/dns/tasks/check.go @@ -1,9 +1,10 @@ package tasks import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "time" ) type CheckAction struct { diff --git a/internal/web/actions/default/dns/tasks/deleteAll.go b/internal/web/actions/default/dns/tasks/deleteAll.go index f57cd489..aa95c486 100644 --- a/internal/web/actions/default/dns/tasks/deleteAll.go +++ b/internal/web/actions/default/dns/tasks/deleteAll.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package tasks diff --git a/internal/web/actions/default/files/file.go b/internal/web/actions/default/files/file.go index 3bc2ff25..034caf75 100644 --- a/internal/web/actions/default/files/file.go +++ b/internal/web/actions/default/files/file.go @@ -1,13 +1,14 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package files import ( + "mime" + "path/filepath" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/types" - "mime" - "path/filepath" ) type FileAction struct { diff --git a/internal/web/actions/default/files/init.go b/internal/web/actions/default/files/init.go index 4e6a0cc1..0c9999bc 100644 --- a/internal/web/actions/default/files/init.go +++ b/internal/web/actions/default/files/init.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package files diff --git a/internal/web/actions/default/index/index.go b/internal/web/actions/default/index/index.go index d8f82198..be1d49dc 100644 --- a/internal/web/actions/default/index/index.go +++ b/internal/web/actions/default/index/index.go @@ -2,6 +2,9 @@ package index import ( "fmt" + "net" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" @@ -24,8 +27,6 @@ import ( "github.com/iwind/TeaGo/rands" "github.com/iwind/TeaGo/types" stringutil "github.com/iwind/TeaGo/utils/string" - "net" - "time" ) const regionDenyMessage = "当前软件系统暂时不为你所在的区域提供服务。" diff --git a/internal/web/actions/default/index/initPassword.go b/internal/web/actions/default/index/initPassword.go index 8726ea64..4fb697bc 100644 --- a/internal/web/actions/default/index/initPassword.go +++ b/internal/web/actions/default/index/initPassword.go @@ -1,13 +1,14 @@ -// 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 index import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/actions" - "net/http" ) type InitPasswordAction struct { diff --git a/internal/web/actions/default/index/loginutils/utils.go b/internal/web/actions/default/index/loginutils/utils.go index 0cf034d5..5f3a73d7 100644 --- a/internal/web/actions/default/index/loginutils/utils.go +++ b/internal/web/actions/default/index/loginutils/utils.go @@ -1,17 +1,18 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package loginutils import ( + "net" + "net/http" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/iwind/TeaGo/actions" stringutil "github.com/iwind/TeaGo/utils/string" - "net" - "net/http" - "regexp" - "strings" ) // CalculateClientFingerprint 计算客户端指纹 diff --git a/internal/web/actions/default/index/otp.go b/internal/web/actions/default/index/otp.go index 7c482d2c..80b0d5d7 100644 --- a/internal/web/actions/default/index/otp.go +++ b/internal/web/actions/default/index/otp.go @@ -1,10 +1,12 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package index import ( "encoding/json" "fmt" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" @@ -22,7 +24,6 @@ import ( "github.com/iwind/TeaGo/rands" stringutil "github.com/iwind/TeaGo/utils/string" "github.com/xlzd/gotp" - "time" ) type OtpAction struct { @@ -44,7 +45,7 @@ func (this *OtpAction) RunGet(params struct { return } - //// 是否新安装 + // // 是否新安装 if setup.IsNewInstalled() { this.RedirectURL("/setup/confirm") return diff --git a/internal/web/actions/default/log/clean.go b/internal/web/actions/default/log/clean.go index d6cbc1a3..ec2d33b2 100644 --- a/internal/web/actions/default/log/clean.go +++ b/internal/web/actions/default/log/clean.go @@ -2,6 +2,7 @@ package log import ( "fmt" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" diff --git a/internal/web/actions/default/log/exportExcel.go b/internal/web/actions/default/log/exportExcel.go index 6e024a72..59777f43 100644 --- a/internal/web/actions/default/log/exportExcel.go +++ b/internal/web/actions/default/log/exportExcel.go @@ -2,12 +2,13 @@ package log import ( "bytes" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" timeutil "github.com/iwind/TeaGo/utils/time" "github.com/tealeg/xlsx/v3" - "strconv" ) type ExportExcelAction struct { diff --git a/internal/web/actions/default/log/helper.go b/internal/web/actions/default/log/helper.go index c53a15a4..92b219fd 100644 --- a/internal/web/actions/default/log/helper.go +++ b/internal/web/actions/default/log/helper.go @@ -1,8 +1,9 @@ package log import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type Helper struct { diff --git a/internal/web/actions/default/log/settings.go b/internal/web/actions/default/log/settings.go index febdfb3e..f5f77c14 100644 --- a/internal/web/actions/default/log/settings.go +++ b/internal/web/actions/default/log/settings.go @@ -2,6 +2,7 @@ package log import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/login/ticket.go b/internal/web/actions/default/login/ticket.go index 05559139..34448b50 100644 --- a/internal/web/actions/default/login/ticket.go +++ b/internal/web/actions/default/login/ticket.go @@ -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 login diff --git a/internal/web/actions/default/login/validate.go b/internal/web/actions/default/login/validate.go index 2043103b..e48a4295 100644 --- a/internal/web/actions/default/login/validate.go +++ b/internal/web/actions/default/login/validate.go @@ -1,13 +1,14 @@ -// 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 login import ( + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/index/loginutils" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/rands" - "net" ) type ValidateAction struct { diff --git a/internal/web/actions/default/nodes/ipAddresses/createPopup.go b/internal/web/actions/default/nodes/ipAddresses/createPopup.go index dbfa476d..994161e9 100644 --- a/internal/web/actions/default/nodes/ipAddresses/createPopup.go +++ b/internal/web/actions/default/nodes/ipAddresses/createPopup.go @@ -2,6 +2,8 @@ package ipAddresses import ( "encoding/json" + "net" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -9,7 +11,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/nodes/ipAddresses/ipaddressutils/utils.go b/internal/web/actions/default/nodes/ipAddresses/ipaddressutils/utils.go index 331d0cce..c5158396 100644 --- a/internal/web/actions/default/nodes/ipAddresses/ipaddressutils/utils.go +++ b/internal/web/actions/default/nodes/ipAddresses/ipaddressutils/utils.go @@ -2,6 +2,7 @@ package ipaddressutils import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" diff --git a/internal/web/actions/default/nodes/ipAddresses/updatePopup.go b/internal/web/actions/default/nodes/ipAddresses/updatePopup.go index eefa5f27..463bc8b4 100644 --- a/internal/web/actions/default/nodes/ipAddresses/updatePopup.go +++ b/internal/web/actions/default/nodes/ipAddresses/updatePopup.go @@ -2,6 +2,8 @@ package ipAddresses import ( "encoding/json" + "net" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -10,7 +12,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net" ) type UpdatePopupAction struct { diff --git a/internal/web/actions/default/nodes/nodeutils/utils.go b/internal/web/actions/default/nodes/nodeutils/utils.go index a6894fcb..27a5aacc 100644 --- a/internal/web/actions/default/nodes/nodeutils/utils.go +++ b/internal/web/actions/default/nodes/nodeutils/utils.go @@ -3,12 +3,13 @@ package nodeutils import ( "context" "encoding/json" - "github.com/TeaOSLab/EdgeAdmin/internal/configs" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc" - "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "sort" "strconv" "sync" + + "github.com/TeaOSLab/EdgeAdmin/internal/configs" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" ) // MessageResult 和节点消息通讯结果定义 diff --git a/internal/web/actions/default/nodes/nodeutils/utils_test.go b/internal/web/actions/default/nodes/nodeutils/utils_test.go index f4745ef8..8b4cb8e7 100644 --- a/internal/web/actions/default/nodes/nodeutils/utils_test.go +++ b/internal/web/actions/default/nodes/nodeutils/utils_test.go @@ -1,10 +1,11 @@ package nodeutils import ( + "testing" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" _ "github.com/iwind/TeaGo/bootstrap" "github.com/iwind/TeaGo/logs" - "testing" ) func TestSendMessageToCluster(t *testing.T) { diff --git a/internal/web/actions/default/recover/updateHosts.go b/internal/web/actions/default/recover/updateHosts.go index 6587acc8..259fb247 100644 --- a/internal/web/actions/default/recover/updateHosts.go +++ b/internal/web/actions/default/recover/updateHosts.go @@ -5,6 +5,7 @@ package recovers import ( "bytes" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" diff --git a/internal/web/actions/default/recover/validateApi.go b/internal/web/actions/default/recover/validateApi.go index bf1ae912..9c79bb26 100644 --- a/internal/web/actions/default/recover/validateApi.go +++ b/internal/web/actions/default/recover/validateApi.go @@ -2,6 +2,8 @@ package recovers import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type ValidateApiAction struct { diff --git a/internal/web/actions/default/servers/addOriginPopup.go b/internal/web/actions/default/servers/addOriginPopup.go index 793daeba..e09aee29 100644 --- a/internal/web/actions/default/servers/addOriginPopup.go +++ b/internal/web/actions/default/servers/addOriginPopup.go @@ -2,6 +2,10 @@ package servers import ( "encoding/json" + "net/url" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -10,9 +14,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/url" - "regexp" - "strings" ) type AddOriginPopupAction struct { diff --git a/internal/web/actions/default/servers/addOriginPopup_ext.go b/internal/web/actions/default/servers/addOriginPopup_ext.go index 45b74704..e52712d7 100644 --- a/internal/web/actions/default/servers/addOriginPopup_ext.go +++ b/internal/web/actions/default/servers/addOriginPopup_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package servers diff --git a/internal/web/actions/default/servers/addPortPopup.go b/internal/web/actions/default/servers/addPortPopup.go index cdb1f54f..d47d4b10 100644 --- a/internal/web/actions/default/servers/addPortPopup.go +++ b/internal/web/actions/default/servers/addPortPopup.go @@ -1,13 +1,14 @@ package servers import ( + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "regexp" - "strings" ) type AddPortPopupAction struct { diff --git a/internal/web/actions/default/servers/addServerNamePopup.go b/internal/web/actions/default/servers/addServerNamePopup.go index 882871c3..c791db98 100644 --- a/internal/web/actions/default/servers/addServerNamePopup.go +++ b/internal/web/actions/default/servers/addServerNamePopup.go @@ -1,13 +1,14 @@ package servers import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/iwind/TeaGo/actions" - "github.com/iwind/TeaGo/maps" "net" "net/url" "regexp" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/maps" ) type AddServerNamePopupAction struct { diff --git a/internal/web/actions/default/servers/certs/acme/create.go b/internal/web/actions/default/servers/certs/acme/create.go index 898050ec..7d333dd8 100644 --- a/internal/web/actions/default/servers/certs/acme/create.go +++ b/internal/web/actions/default/servers/certs/acme/create.go @@ -1,13 +1,14 @@ package acme import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type CreateAction struct { @@ -119,6 +120,7 @@ func (this *CreateAction) RunPost(params struct { Domains: realDomains, AutoRenew: params.AutoRenew, AuthURL: params.AuthURL, + Async: false, }) if err != nil { this.ErrorPage(err) diff --git a/internal/web/actions/default/servers/certs/acme/updateTaskPopup.go b/internal/web/actions/default/servers/certs/acme/updateTaskPopup.go index b943e8cc..a37a3b2c 100644 --- a/internal/web/actions/default/servers/certs/acme/updateTaskPopup.go +++ b/internal/web/actions/default/servers/certs/acme/updateTaskPopup.go @@ -2,13 +2,14 @@ package acme import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type UpdateTaskPopupAction struct { diff --git a/internal/web/actions/default/servers/certs/acme/userOptions.go b/internal/web/actions/default/servers/certs/acme/userOptions.go index e73489f2..bb4064fc 100644 --- a/internal/web/actions/default/servers/certs/acme/userOptions.go +++ b/internal/web/actions/default/servers/certs/acme/userOptions.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package acme diff --git a/internal/web/actions/default/servers/certs/certPopup.go b/internal/web/actions/default/servers/certs/certPopup.go index c2b270e1..8ddd44a1 100644 --- a/internal/web/actions/default/servers/certs/certPopup.go +++ b/internal/web/actions/default/servers/certs/certPopup.go @@ -2,12 +2,13 @@ package certs import ( "encoding/json" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type CertPopupAction struct { diff --git a/internal/web/actions/default/servers/certs/datajs.go b/internal/web/actions/default/servers/certs/datajs.go index 303f65ed..1b77de3f 100644 --- a/internal/web/actions/default/servers/certs/datajs.go +++ b/internal/web/actions/default/servers/certs/datajs.go @@ -2,6 +2,7 @@ package certs import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" ) diff --git a/internal/web/actions/default/servers/certs/delete_ext.go b/internal/web/actions/default/servers/certs/delete_ext.go index e2c06f5c..74594bb1 100644 --- a/internal/web/actions/default/servers/certs/delete_ext.go +++ b/internal/web/actions/default/servers/certs/delete_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package certs diff --git a/internal/web/actions/default/servers/certs/downloadCert.go b/internal/web/actions/default/servers/certs/downloadCert.go index 44491fe9..bdab5290 100644 --- a/internal/web/actions/default/servers/certs/downloadCert.go +++ b/internal/web/actions/default/servers/certs/downloadCert.go @@ -2,11 +2,12 @@ package certs import ( "encoding/json" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" - "strconv" ) type DownloadCertAction struct { diff --git a/internal/web/actions/default/servers/certs/downloadKey.go b/internal/web/actions/default/servers/certs/downloadKey.go index b300e2cb..b7b245a4 100644 --- a/internal/web/actions/default/servers/certs/downloadKey.go +++ b/internal/web/actions/default/servers/certs/downloadKey.go @@ -2,11 +2,12 @@ package certs import ( "encoding/json" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" - "strconv" ) type DownloadKeyAction struct { diff --git a/internal/web/actions/default/servers/certs/downloadZip.go b/internal/web/actions/default/servers/certs/downloadZip.go index f7b34eac..1d801c35 100644 --- a/internal/web/actions/default/servers/certs/downloadZip.go +++ b/internal/web/actions/default/servers/certs/downloadZip.go @@ -3,11 +3,12 @@ package certs import ( "archive/zip" "encoding/json" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" - "strconv" ) type DownloadZipAction struct { diff --git a/internal/web/actions/default/servers/certs/helper.go b/internal/web/actions/default/servers/certs/helper.go index 852bad67..d651503f 100644 --- a/internal/web/actions/default/servers/certs/helper.go +++ b/internal/web/actions/default/servers/certs/helper.go @@ -1,6 +1,8 @@ package certs import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -8,7 +10,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" ) type Helper struct { diff --git a/internal/web/actions/default/servers/certs/index.go b/internal/web/actions/default/servers/certs/index.go index 5cae04c6..f318b1fc 100644 --- a/internal/web/actions/default/servers/certs/index.go +++ b/internal/web/actions/default/servers/certs/index.go @@ -2,12 +2,13 @@ package certs import ( "encoding/json" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/certs/ocsp/index.go b/internal/web/actions/default/servers/certs/ocsp/index.go index ca36df09..bcaadec8 100644 --- a/internal/web/actions/default/servers/certs/ocsp/index.go +++ b/internal/web/actions/default/servers/certs/ocsp/index.go @@ -3,11 +3,12 @@ package ocsp import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/certs/selectPopup.go b/internal/web/actions/default/servers/certs/selectPopup.go index 213485be..9d034eb5 100644 --- a/internal/web/actions/default/servers/certs/selectPopup.go +++ b/internal/web/actions/default/servers/certs/selectPopup.go @@ -3,6 +3,9 @@ package certs import ( "encoding/json" "errors" + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -11,8 +14,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "strings" - "time" ) // SelectPopupAction 选择证书 diff --git a/internal/web/actions/default/servers/certs/updatePopup.go b/internal/web/actions/default/servers/certs/updatePopup.go index 602d9831..7d398707 100644 --- a/internal/web/actions/default/servers/certs/updatePopup.go +++ b/internal/web/actions/default/servers/certs/updatePopup.go @@ -3,6 +3,7 @@ package certs import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/certs/uploadBatchPopup.go b/internal/web/actions/default/servers/certs/uploadBatchPopup.go index 90f6cf33..9242ffba 100644 --- a/internal/web/actions/default/servers/certs/uploadBatchPopup.go +++ b/internal/web/actions/default/servers/certs/uploadBatchPopup.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package certs @@ -6,15 +6,16 @@ import ( "bytes" "context" "crypto/tls" + "io" + "mime/multipart" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "io" - "mime/multipart" - "strings" ) // UploadBatchPopupAction 批量上传证书 diff --git a/internal/web/actions/default/servers/certs/uploadBatchPopup_ext.go b/internal/web/actions/default/servers/certs/uploadBatchPopup_ext.go index 15492dde..d9c39806 100644 --- a/internal/web/actions/default/servers/certs/uploadBatchPopup_ext.go +++ b/internal/web/actions/default/servers/certs/uploadBatchPopup_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package certs diff --git a/internal/web/actions/default/servers/certs/uploadPopup.go b/internal/web/actions/default/servers/certs/uploadPopup.go index d8cb9f01..635bdda4 100644 --- a/internal/web/actions/default/servers/certs/uploadPopup.go +++ b/internal/web/actions/default/servers/certs/uploadPopup.go @@ -3,6 +3,7 @@ package certs import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/certs/viewCert.go b/internal/web/actions/default/servers/certs/viewCert.go index 6b53b702..17b38126 100644 --- a/internal/web/actions/default/servers/certs/viewCert.go +++ b/internal/web/actions/default/servers/certs/viewCert.go @@ -2,6 +2,7 @@ package certs import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" diff --git a/internal/web/actions/default/servers/certs/viewKey.go b/internal/web/actions/default/servers/certs/viewKey.go index 4f9b71d5..c942b8b0 100644 --- a/internal/web/actions/default/servers/certs/viewKey.go +++ b/internal/web/actions/default/servers/certs/viewKey.go @@ -2,6 +2,7 @@ package certs import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" diff --git a/internal/web/actions/default/servers/components/cache/batch/deleteTask.go b/internal/web/actions/default/servers/components/cache/batch/deleteTask.go index 28ba7ca9..ba084f52 100644 --- a/internal/web/actions/default/servers/components/cache/batch/deleteTask.go +++ b/internal/web/actions/default/servers/components/cache/batch/deleteTask.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache diff --git a/internal/web/actions/default/servers/components/cache/batch/fetch.go b/internal/web/actions/default/servers/components/cache/batch/fetch.go index a00ae2b9..2de2676d 100644 --- a/internal/web/actions/default/servers/components/cache/batch/fetch.go +++ b/internal/web/actions/default/servers/components/cache/batch/fetch.go @@ -1,8 +1,10 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type FetchAction struct { diff --git a/internal/web/actions/default/servers/components/cache/batch/index.go b/internal/web/actions/default/servers/components/cache/batch/index.go index b9d8b010..82fb1a19 100644 --- a/internal/web/actions/default/servers/components/cache/batch/index.go +++ b/internal/web/actions/default/servers/components/cache/batch/index.go @@ -1,8 +1,10 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/components/cache/batch/resetTask.go b/internal/web/actions/default/servers/components/cache/batch/resetTask.go index 21f92745..af58667a 100644 --- a/internal/web/actions/default/servers/components/cache/batch/resetTask.go +++ b/internal/web/actions/default/servers/components/cache/batch/resetTask.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache diff --git a/internal/web/actions/default/servers/components/cache/batch/task.go b/internal/web/actions/default/servers/components/cache/batch/task.go index 9628ceca..9516f07e 100644 --- a/internal/web/actions/default/servers/components/cache/batch/task.go +++ b/internal/web/actions/default/servers/components/cache/batch/task.go @@ -1,14 +1,15 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache import ( "encoding/json" + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "sort" ) type TaskAction struct { diff --git a/internal/web/actions/default/servers/components/cache/batch/tasks.go b/internal/web/actions/default/servers/components/cache/batch/tasks.go index 475031cf..17c28502 100644 --- a/internal/web/actions/default/servers/components/cache/batch/tasks.go +++ b/internal/web/actions/default/servers/components/cache/batch/tasks.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache diff --git a/internal/web/actions/default/servers/components/cache/batch/utils.go b/internal/web/actions/default/servers/components/cache/batch/utils.go index c1a62cd4..2164e688 100644 --- a/internal/web/actions/default/servers/components/cache/batch/utils.go +++ b/internal/web/actions/default/servers/components/cache/batch/utils.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package cache diff --git a/internal/web/actions/default/servers/components/cache/cacheutils/utils.go b/internal/web/actions/default/servers/components/cache/cacheutils/utils.go index c7dda883..07b080f7 100644 --- a/internal/web/actions/default/servers/components/cache/cacheutils/utils.go +++ b/internal/web/actions/default/servers/components/cache/cacheutils/utils.go @@ -2,6 +2,7 @@ package cacheutils import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/errors" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/components/cache/clean.go b/internal/web/actions/default/servers/components/cache/clean.go index 824897c9..bbdc79e8 100644 --- a/internal/web/actions/default/servers/components/cache/clean.go +++ b/internal/web/actions/default/servers/components/cache/clean.go @@ -1,6 +1,9 @@ package cache import ( + "net/http" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,8 +12,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" - "strconv" ) type CleanAction struct { diff --git a/internal/web/actions/default/servers/components/cache/createPopup.go b/internal/web/actions/default/servers/components/cache/createPopup.go index 33424c02..3c7bdf4d 100644 --- a/internal/web/actions/default/servers/components/cache/createPopup.go +++ b/internal/web/actions/default/servers/components/cache/createPopup.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/components/cache/fetch.go b/internal/web/actions/default/servers/components/cache/fetch.go index 8ef93089..ba4d8161 100644 --- a/internal/web/actions/default/servers/components/cache/fetch.go +++ b/internal/web/actions/default/servers/components/cache/fetch.go @@ -1,6 +1,10 @@ package cache import ( + "net/http" + "strconv" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,9 +13,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" - "strconv" - "strings" ) type FetchAction struct { diff --git a/internal/web/actions/default/servers/components/cache/helper.go b/internal/web/actions/default/servers/components/cache/helper.go index 4c79a1bf..7aea48d2 100644 --- a/internal/web/actions/default/servers/components/cache/helper.go +++ b/internal/web/actions/default/servers/components/cache/helper.go @@ -1,10 +1,11 @@ package cache import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/iwind/TeaGo/actions" - "net/http" ) type Helper struct { diff --git a/internal/web/actions/default/servers/components/cache/index.go b/internal/web/actions/default/servers/components/cache/index.go index 058bdee4..3997f5a9 100644 --- a/internal/web/actions/default/servers/components/cache/index.go +++ b/internal/web/actions/default/servers/components/cache/index.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/components/cache/purge.go b/internal/web/actions/default/servers/components/cache/purge.go index a74eb91f..de6adf13 100644 --- a/internal/web/actions/default/servers/components/cache/purge.go +++ b/internal/web/actions/default/servers/components/cache/purge.go @@ -1,6 +1,11 @@ package cache -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "net/http" + "strconv" + "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -8,9 +13,6 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" - "strconv" - "strings" ) type PurgeAction struct { diff --git a/internal/web/actions/default/servers/components/cache/selectPopup.go b/internal/web/actions/default/servers/components/cache/selectPopup.go index 4a158cbf..9b8cf688 100644 --- a/internal/web/actions/default/servers/components/cache/selectPopup.go +++ b/internal/web/actions/default/servers/components/cache/selectPopup.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/components/cache/stat.go b/internal/web/actions/default/servers/components/cache/stat.go index 86efe671..3aef7045 100644 --- a/internal/web/actions/default/servers/components/cache/stat.go +++ b/internal/web/actions/default/servers/components/cache/stat.go @@ -1,6 +1,9 @@ package cache import ( + "net/http" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,8 +12,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" - "strconv" ) type StatAction struct { diff --git a/internal/web/actions/default/servers/components/cache/testRead.go b/internal/web/actions/default/servers/components/cache/testRead.go index d00d7b7b..5ddb2034 100644 --- a/internal/web/actions/default/servers/components/cache/testRead.go +++ b/internal/web/actions/default/servers/components/cache/testRead.go @@ -1,13 +1,14 @@ package cache import ( + "net/http" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/messageconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "net/http" - "strconv" ) type TestReadAction struct { diff --git a/internal/web/actions/default/servers/components/cache/testWrite.go b/internal/web/actions/default/servers/components/cache/testWrite.go index 5b67c216..9a02d8ad 100644 --- a/internal/web/actions/default/servers/components/cache/testWrite.go +++ b/internal/web/actions/default/servers/components/cache/testWrite.go @@ -1,13 +1,14 @@ package cache import ( + "net/http" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/nodeutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/messageconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "net/http" - "strconv" ) type TestWriteAction struct { diff --git a/internal/web/actions/default/servers/components/cache/update.go b/internal/web/actions/default/servers/components/cache/update.go index 24502fe3..df895657 100644 --- a/internal/web/actions/default/servers/components/cache/update.go +++ b/internal/web/actions/default/servers/components/cache/update.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/components/log/helper.go b/internal/web/actions/default/servers/components/log/helper.go index 437cd251..7c91f224 100644 --- a/internal/web/actions/default/servers/components/log/helper.go +++ b/internal/web/actions/default/servers/components/log/helper.go @@ -1,8 +1,9 @@ package log import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type Helper struct { diff --git a/internal/web/actions/default/servers/components/waf/createRulePopup.go b/internal/web/actions/default/servers/components/waf/createRulePopup.go index be751bf0..281e6c76 100644 --- a/internal/web/actions/default/servers/components/waf/createRulePopup.go +++ b/internal/web/actions/default/servers/components/waf/createRulePopup.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/actions" diff --git a/internal/web/actions/default/servers/components/waf/createSetPopup.go b/internal/web/actions/default/servers/components/waf/createSetPopup.go index 238346c1..fb5d8f28 100644 --- a/internal/web/actions/default/servers/components/waf/createSetPopup.go +++ b/internal/web/actions/default/servers/components/waf/createSetPopup.go @@ -2,6 +2,8 @@ package waf import ( "encoding/json" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -9,7 +11,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strconv" ) type CreateSetPopupAction struct { diff --git a/internal/web/actions/default/servers/components/waf/deleteSet.go b/internal/web/actions/default/servers/components/waf/deleteSet.go index 8d134e02..fcfb2b78 100644 --- a/internal/web/actions/default/servers/components/waf/deleteSet.go +++ b/internal/web/actions/default/servers/components/waf/deleteSet.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/components/waf/export.go b/internal/web/actions/default/servers/components/waf/export.go index d72e2528..a6900b60 100644 --- a/internal/web/actions/default/servers/components/waf/export.go +++ b/internal/web/actions/default/servers/components/waf/export.go @@ -2,6 +2,8 @@ package waf import ( "encoding/json" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/ttlcache" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,7 +11,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/rands" - "time" ) type ExportAction struct { diff --git a/internal/web/actions/default/servers/components/waf/exportDownload.go b/internal/web/actions/default/servers/components/waf/exportDownload.go index 6f68f6d5..14b1c425 100644 --- a/internal/web/actions/default/servers/components/waf/exportDownload.go +++ b/internal/web/actions/default/servers/components/waf/exportDownload.go @@ -1,10 +1,11 @@ package waf import ( + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/ttlcache" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/types" - "strconv" ) type ExportDownloadAction struct { diff --git a/internal/web/actions/default/servers/components/waf/group.go b/internal/web/actions/default/servers/components/waf/group.go index a113edb2..d494556e 100644 --- a/internal/web/actions/default/servers/components/waf/group.go +++ b/internal/web/actions/default/servers/components/waf/group.go @@ -1,12 +1,13 @@ package waf import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type GroupAction struct { diff --git a/internal/web/actions/default/servers/components/waf/helper.go b/internal/web/actions/default/servers/components/waf/helper.go index 1a1a87af..80828093 100644 --- a/internal/web/actions/default/servers/components/waf/helper.go +++ b/internal/web/actions/default/servers/components/waf/helper.go @@ -2,11 +2,12 @@ package waf import ( "encoding/json" + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/actions" - "net/http" ) type Helper struct { diff --git a/internal/web/actions/default/servers/components/waf/import.go b/internal/web/actions/default/servers/components/waf/import.go index 79855a51..a1215492 100644 --- a/internal/web/actions/default/servers/components/waf/import.go +++ b/internal/web/actions/default/servers/components/waf/import.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/components/waf/index.go b/internal/web/actions/default/servers/components/waf/index.go index 20d2a2c4..402c3469 100644 --- a/internal/web/actions/default/servers/components/waf/index.go +++ b/internal/web/actions/default/servers/components/waf/index.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" diff --git a/internal/web/actions/default/servers/components/waf/init.go b/internal/web/actions/default/servers/components/waf/init.go index a4e67ffe..f0325d92 100644 --- a/internal/web/actions/default/servers/components/waf/init.go +++ b/internal/web/actions/default/servers/components/waf/init.go @@ -47,6 +47,7 @@ func init() { // IP管理 GetPost("/ipadmin", new(ipadmin.IndexAction)). GetPost("/ipadmin/provinces", new(ipadmin.ProvincesAction)). + GetPost("/ipadmin/providers", new(ipadmin.ProvidersAction)). Get("/ipadmin/lists", new(ipadmin.ListsAction)). GetPost("/ipadmin/updateIPPopup", new(ipadmin.UpdateIPPopupAction)). Post("/ipadmin/deleteIP", new(ipadmin.DeleteIPAction)). diff --git a/internal/web/actions/default/servers/components/waf/ipadmin/index.go b/internal/web/actions/default/servers/components/waf/ipadmin/index.go index 4e85e166..b59a7bf4 100644 --- a/internal/web/actions/default/servers/components/waf/ipadmin/index.go +++ b/internal/web/actions/default/servers/components/waf/ipadmin/index.go @@ -2,6 +2,8 @@ package ipadmin import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/components/waf/ipadmin/lists.go b/internal/web/actions/default/servers/components/waf/ipadmin/lists.go index 631355d2..d35ba16a 100644 --- a/internal/web/actions/default/servers/components/waf/ipadmin/lists.go +++ b/internal/web/actions/default/servers/components/waf/ipadmin/lists.go @@ -1,13 +1,14 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type ListsAction struct { diff --git a/internal/web/actions/default/servers/components/waf/ipadmin/providers.go b/internal/web/actions/default/servers/components/waf/ipadmin/providers.go new file mode 100644 index 00000000..fb408b54 --- /dev/null +++ b/internal/web/actions/default/servers/components/waf/ipadmin/providers.go @@ -0,0 +1,176 @@ +package ipadmin + +import ( + "encoding/json" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" + "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/lists" + "github.com/iwind/TeaGo/maps" +) + +type ProvidersAction struct { + actionutils.ParentAction +} + +func (this *ProvidersAction) Init() { + this.Nav("", "", "ipadmin") +} + +func (this *ProvidersAction) RunGet(params struct { + FirewallPolicyId int64 +}) { + this.Data["subMenuItem"] = "provider" + + // 当前选中的运营商 + policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId) + if err != nil { + this.ErrorPage(err) + return + } + if policyConfig == nil { + this.NotFound("firewallPolicy", params.FirewallPolicyId) + return + } + + var deniedProviderIds = []int64{} + var allowedProviderIds = []int64{} + var providerHTML string + if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { + deniedProviderIds = policyConfig.Inbound.Region.DenyProviderIds + allowedProviderIds = policyConfig.Inbound.Region.AllowProviderIds + providerHTML = policyConfig.Inbound.Region.ProviderHTML + } + this.Data["providerHTML"] = providerHTML + + providerResp, err := this.RPC().RegionProviderRPC().FindAllRegionProviders(this.AdminContext(), &pb.FindAllRegionProvidersRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + var deniedProviderMaps = []maps.Map{} + var allowedProviderMaps = []maps.Map{} + for _, provider := range providerResp.RegionProviders { + var providerMap = maps.Map{ + "id": provider.Id, + "name": provider.Name, + } + if lists.ContainsInt64(deniedProviderIds, provider.Id) { + deniedProviderMaps = append(deniedProviderMaps, providerMap) + } + if lists.ContainsInt64(allowedProviderIds, provider.Id) { + allowedProviderMaps = append(allowedProviderMaps, providerMap) + } + } + this.Data["deniedProviders"] = deniedProviderMaps + this.Data["allowedProviders"] = allowedProviderMaps + + // except & only URL Patterns + this.Data["exceptURLPatterns"] = []*shared.URLPattern{} + this.Data["onlyURLPatterns"] = []*shared.URLPattern{} + if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { + if len(policyConfig.Inbound.Region.ProviderExceptURLPatterns) > 0 { + this.Data["exceptURLPatterns"] = policyConfig.Inbound.Region.ProviderExceptURLPatterns + } + if len(policyConfig.Inbound.Region.ProviderOnlyURLPatterns) > 0 { + this.Data["onlyURLPatterns"] = policyConfig.Inbound.Region.ProviderOnlyURLPatterns + } + } + + this.Show() +} + +func (this *ProvidersAction) RunPost(params struct { + FirewallPolicyId int64 + + DenyProviderIds []int64 + AllowProviderIds []int64 + + ExceptURLPatternsJSON []byte + OnlyURLPatternsJSON []byte + + ProviderHTML string + + Must *actions.Must +}) { + // 日志 + defer this.CreateLogInfo(codes.WAF_LogUpdateForbiddenProviders, params.FirewallPolicyId) + + policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId) + if err != nil { + this.ErrorPage(err) + return + } + if policyConfig == nil { + this.NotFound("firewallPolicy", params.FirewallPolicyId) + return + } + + if policyConfig.Inbound == nil { + policyConfig.Inbound = &firewallconfigs.HTTPFirewallInboundConfig{IsOn: true} + } + if policyConfig.Inbound.Region == nil { + policyConfig.Inbound.Region = &firewallconfigs.HTTPFirewallRegionConfig{ + IsOn: true, + } + } + policyConfig.Inbound.Region.DenyProviderIds = params.DenyProviderIds + policyConfig.Inbound.Region.AllowProviderIds = params.AllowProviderIds + + // 例外URL + var exceptURLPatterns = []*shared.URLPattern{} + if len(params.ExceptURLPatternsJSON) > 0 { + err = json.Unmarshal(params.ExceptURLPatternsJSON, &exceptURLPatterns) + if err != nil { + this.Fail("校验例外URL参数失败:" + err.Error()) + return + } + } + policyConfig.Inbound.Region.ProviderExceptURLPatterns = exceptURLPatterns + + // 限制URL + var onlyURLPatterns = []*shared.URLPattern{} + if len(params.OnlyURLPatternsJSON) > 0 { + err = json.Unmarshal(params.OnlyURLPatternsJSON, &onlyURLPatterns) + if err != nil { + this.Fail("校验限制URL参数失败:" + err.Error()) + return + } + } + policyConfig.Inbound.Region.ProviderOnlyURLPatterns = onlyURLPatterns + + // 自定义提示 + if len(params.ProviderHTML) > 32<<10 { + this.Fail("提示内容长度不能超出32K") + return + } + policyConfig.Inbound.Region.ProviderHTML = params.ProviderHTML + + err = policyConfig.Init() + if err != nil { + this.Fail("配置校验失败:" + err.Error()) + return + } + + inboundJSON, err := json.Marshal(policyConfig.Inbound) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().HTTPFirewallPolicyRPC().UpdateHTTPFirewallInboundConfig(this.AdminContext(), &pb.UpdateHTTPFirewallInboundConfigRequest{ + HttpFirewallPolicyId: params.FirewallPolicyId, + InboundJSON: inboundJSON, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/servers/components/waf/ipadmin/provinces.go b/internal/web/actions/default/servers/components/waf/ipadmin/provinces.go index 4165dd3a..41926cbd 100644 --- a/internal/web/actions/default/servers/components/waf/ipadmin/provinces.go +++ b/internal/web/actions/default/servers/components/waf/ipadmin/provinces.go @@ -2,6 +2,7 @@ package ipadmin import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/components/waf/log.go b/internal/web/actions/default/servers/components/waf/log.go index 593198c7..29c0cc48 100644 --- a/internal/web/actions/default/servers/components/waf/log.go +++ b/internal/web/actions/default/servers/components/waf/log.go @@ -2,6 +2,9 @@ package waf import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -9,8 +12,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "regexp" - "strings" ) type LogAction struct { diff --git a/internal/web/actions/default/servers/components/waf/selectPopup.go b/internal/web/actions/default/servers/components/waf/selectPopup.go index 6c44ea88..13abae2b 100644 --- a/internal/web/actions/default/servers/components/waf/selectPopup.go +++ b/internal/web/actions/default/servers/components/waf/selectPopup.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" diff --git a/internal/web/actions/default/servers/components/waf/setCodePopup.go b/internal/web/actions/default/servers/components/waf/setCodePopup.go index 4019424d..0c94ddcd 100644 --- a/internal/web/actions/default/servers/components/waf/setCodePopup.go +++ b/internal/web/actions/default/servers/components/waf/setCodePopup.go @@ -1,9 +1,10 @@ -// 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 waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" diff --git a/internal/web/actions/default/servers/components/waf/sortSets.go b/internal/web/actions/default/servers/components/waf/sortSets.go index d2b2852b..ca72c831 100644 --- a/internal/web/actions/default/servers/components/waf/sortSets.go +++ b/internal/web/actions/default/servers/components/waf/sortSets.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/components/waf/testRegexp.go b/internal/web/actions/default/servers/components/waf/testRegexp.go index 8d0abf3e..743e4a69 100644 --- a/internal/web/actions/default/servers/components/waf/testRegexp.go +++ b/internal/web/actions/default/servers/components/waf/testRegexp.go @@ -3,10 +3,11 @@ package waf import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/iwind/TeaGo/maps" "regexp" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/maps" ) type TestRegexpAction struct { diff --git a/internal/web/actions/default/servers/components/waf/update.go b/internal/web/actions/default/servers/components/waf/update.go index d3c1ced7..09c1d1d2 100644 --- a/internal/web/actions/default/servers/components/waf/update.go +++ b/internal/web/actions/default/servers/components/waf/update.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/components/waf/updateSetPopup.go b/internal/web/actions/default/servers/components/waf/updateSetPopup.go index 80875f96..00f8964b 100644 --- a/internal/web/actions/default/servers/components/waf/updateSetPopup.go +++ b/internal/web/actions/default/servers/components/waf/updateSetPopup.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/components/waf/upgradeTemplate.go b/internal/web/actions/default/servers/components/waf/upgradeTemplate.go index e0be3c08..de9e2fed 100644 --- a/internal/web/actions/default/servers/components/waf/upgradeTemplate.go +++ b/internal/web/actions/default/servers/components/waf/upgradeTemplate.go @@ -4,6 +4,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/create.go b/internal/web/actions/default/servers/create.go index 562451aa..7b56cd45 100644 --- a/internal/web/actions/default/servers/create.go +++ b/internal/web/actions/default/servers/create.go @@ -2,6 +2,8 @@ package servers import ( "encoding/json" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -13,7 +15,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type CreateAction struct { diff --git a/internal/web/actions/default/servers/deleteServers.go b/internal/web/actions/default/servers/deleteServers.go index 0cadead8..602c256a 100644 --- a/internal/web/actions/default/servers/deleteServers.go +++ b/internal/web/actions/default/servers/deleteServers.go @@ -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 servers diff --git a/internal/web/actions/default/servers/groups/group/index.go b/internal/web/actions/default/servers/groups/group/index.go index fc5916f3..d5878e80 100644 --- a/internal/web/actions/default/servers/groups/group/index.go +++ b/internal/web/actions/default/servers/groups/group/index.go @@ -4,6 +4,7 @@ package group import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" diff --git a/internal/web/actions/default/servers/groups/group/servergrouputils/utils.go b/internal/web/actions/default/servers/groups/group/servergrouputils/utils.go index 95e90076..391934c2 100644 --- a/internal/web/actions/default/servers/groups/group/servergrouputils/utils.go +++ b/internal/web/actions/default/servers/groups/group/servergrouputils/utils.go @@ -4,6 +4,7 @@ package servergrouputils import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/cache/fetch.go b/internal/web/actions/default/servers/groups/group/settings/cache/fetch.go index ee40d898..630304a8 100644 --- a/internal/web/actions/default/servers/groups/group/settings/cache/fetch.go +++ b/internal/web/actions/default/servers/groups/group/settings/cache/fetch.go @@ -2,7 +2,10 @@ package cache -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type FetchAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/cache/index.go b/internal/web/actions/default/servers/groups/group/settings/cache/index.go index 6aa233a8..aa1ef5af 100644 --- a/internal/web/actions/default/servers/groups/group/settings/cache/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/cache/index.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/cache/purge.go b/internal/web/actions/default/servers/groups/group/settings/cache/purge.go index fb8f24c2..a4e0e8f8 100644 --- a/internal/web/actions/default/servers/groups/group/settings/cache/purge.go +++ b/internal/web/actions/default/servers/groups/group/settings/cache/purge.go @@ -2,7 +2,10 @@ package cache -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type PurgeAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/compression/index.go b/internal/web/actions/default/servers/groups/group/settings/compression/index.go index 44597d38..9c79a5a1 100644 --- a/internal/web/actions/default/servers/groups/group/settings/compression/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/compression/index.go @@ -4,6 +4,7 @@ package compression import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/headers/index.go b/internal/web/actions/default/servers/groups/group/settings/headers/index.go index 9cf02acc..7c81a8e8 100644 --- a/internal/web/actions/default/servers/groups/group/settings/headers/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/headers/index.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/index.go b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/index.go index 30c5d3f6..2d74904a 100644 --- a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/index.go @@ -2,6 +2,7 @@ package httpReverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/scheduling.go b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/scheduling.go index bb4e445c..0d66863f 100644 --- a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/scheduling.go +++ b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/scheduling.go @@ -3,6 +3,7 @@ package httpReverseProxy import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/setting.go b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/setting.go index dd1ba5bd..123ddf86 100644 --- a/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/setting.go +++ b/internal/web/actions/default/servers/groups/group/settings/httpReverseProxy/setting.go @@ -3,6 +3,7 @@ package httpReverseProxy import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/remoteAddr/index.go b/internal/web/actions/default/servers/groups/group/settings/remoteAddr/index.go index 608db790..8b5998d4 100644 --- a/internal/web/actions/default/servers/groups/group/settings/remoteAddr/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/remoteAddr/index.go @@ -4,14 +4,15 @@ package remoteAddr import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" - "regexp" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/index.go b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/index.go index 2b8ff37c..f74cb445 100644 --- a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/index.go @@ -2,6 +2,7 @@ package tcpReverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/scheduling.go b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/scheduling.go index 9a83d3d1..da3d9c6c 100644 --- a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/scheduling.go +++ b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/scheduling.go @@ -3,6 +3,7 @@ package tcpReverseProxy import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/setting.go b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/setting.go index 65128b53..c484cc16 100644 --- a/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/setting.go +++ b/internal/web/actions/default/servers/groups/group/settings/tcpReverseProxy/setting.go @@ -3,6 +3,7 @@ package tcpReverseProxy import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/index.go b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/index.go index b14f4197..e934cabe 100644 --- a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/index.go @@ -2,6 +2,7 @@ package udpReverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/scheduling.go b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/scheduling.go index 3ae936fa..c29d2bcb 100644 --- a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/scheduling.go +++ b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/scheduling.go @@ -3,6 +3,7 @@ package udpReverseProxy import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/setting.go b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/setting.go index 398b60c3..b6c9b2ea 100644 --- a/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/setting.go +++ b/internal/web/actions/default/servers/groups/group/settings/udpReverseProxy/setting.go @@ -3,6 +3,7 @@ package udpReverseProxy import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/group/settings/waf/group.go b/internal/web/actions/default/servers/groups/group/settings/waf/group.go index 28d5884e..b5909c3c 100644 --- a/internal/web/actions/default/servers/groups/group/settings/waf/group.go +++ b/internal/web/actions/default/servers/groups/group/settings/waf/group.go @@ -1,12 +1,13 @@ package waf import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type GroupAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/allowList.go b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/allowList.go index b2e9d1ee..cca0b0c6 100644 --- a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/allowList.go +++ b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/allowList.go @@ -1,13 +1,14 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type AllowListAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/countries.go b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/countries.go index 445bc034..2bd18954 100644 --- a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/countries.go +++ b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/countries.go @@ -2,6 +2,8 @@ package ipadmin import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type CountriesAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/denyList.go b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/denyList.go index 0d6f1c66..283508f4 100644 --- a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/denyList.go +++ b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/denyList.go @@ -1,13 +1,14 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type DenyListAction struct { diff --git a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/provinces.go b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/provinces.go index 29138b21..83eaae85 100644 --- a/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/provinces.go +++ b/internal/web/actions/default/servers/groups/group/settings/waf/ipadmin/provinces.go @@ -2,6 +2,7 @@ package ipadmin import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/groups/group/settings/webp/index.go b/internal/web/actions/default/servers/groups/group/settings/webp/index.go index f5281b0d..a51b36bc 100644 --- a/internal/web/actions/default/servers/groups/group/settings/webp/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/webp/index.go @@ -4,6 +4,7 @@ package webp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/groups/group/settings/websocket/index.go b/internal/web/actions/default/servers/groups/group/settings/websocket/index.go index c22381ce..6734b1b0 100644 --- a/internal/web/actions/default/servers/groups/group/settings/websocket/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/websocket/index.go @@ -2,6 +2,7 @@ package websocket import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/groups/helper.go b/internal/web/actions/default/servers/groups/helper.go index b720441c..4ef360b5 100644 --- a/internal/web/actions/default/servers/groups/helper.go +++ b/internal/web/actions/default/servers/groups/helper.go @@ -1,8 +1,9 @@ package groups import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type Helper struct { diff --git a/internal/web/actions/default/servers/groups/selectPopup.go b/internal/web/actions/default/servers/groups/selectPopup.go index 7dc914dc..a83d3578 100644 --- a/internal/web/actions/default/servers/groups/selectPopup.go +++ b/internal/web/actions/default/servers/groups/selectPopup.go @@ -1,13 +1,14 @@ package groups import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type SelectPopupAction struct { diff --git a/internal/web/actions/default/servers/headers/options.go b/internal/web/actions/default/servers/headers/options.go index 12d8bc99..7dbabd05 100644 --- a/internal/web/actions/default/servers/headers/options.go +++ b/internal/web/actions/default/servers/headers/options.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package headers diff --git a/internal/web/actions/default/servers/index.go b/internal/web/actions/default/servers/index.go index c2eeb73a..bf1af98e 100644 --- a/internal/web/actions/default/servers/index.go +++ b/internal/web/actions/default/servers/index.go @@ -2,6 +2,7 @@ package servers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" diff --git a/internal/web/actions/default/servers/ipbox/addIP.go b/internal/web/actions/default/servers/ipbox/addIP.go index d71c189d..7a3ba2ee 100644 --- a/internal/web/actions/default/servers/ipbox/addIP.go +++ b/internal/web/actions/default/servers/ipbox/addIP.go @@ -3,11 +3,12 @@ package ipbox import ( + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "strings" - "time" ) type AddIPAction struct { diff --git a/internal/web/actions/default/servers/ipbox/index.go b/internal/web/actions/default/servers/ipbox/index.go index 7d425853..99aad676 100644 --- a/internal/web/actions/default/servers/ipbox/index.go +++ b/internal/web/actions/default/servers/ipbox/index.go @@ -3,12 +3,13 @@ package ipbox import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/iplists/bindHTTPFirewallPopup.go b/internal/web/actions/default/servers/iplists/bindHTTPFirewallPopup.go index 62df1344..e226ed24 100644 --- a/internal/web/actions/default/servers/iplists/bindHTTPFirewallPopup.go +++ b/internal/web/actions/default/servers/iplists/bindHTTPFirewallPopup.go @@ -4,6 +4,7 @@ package iplists import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/iplists/createIPPopup.go b/internal/web/actions/default/servers/iplists/createIPPopup.go index bd48eabc..f1eaf63d 100644 --- a/internal/web/actions/default/servers/iplists/createIPPopup.go +++ b/internal/web/actions/default/servers/iplists/createIPPopup.go @@ -1,6 +1,8 @@ package iplists import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -9,7 +11,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type CreateIPPopupAction struct { diff --git a/internal/web/actions/default/servers/iplists/deleteCount.go b/internal/web/actions/default/servers/iplists/deleteCount.go index b62e824d..c43a4411 100644 --- a/internal/web/actions/default/servers/iplists/deleteCount.go +++ b/internal/web/actions/default/servers/iplists/deleteCount.go @@ -3,12 +3,13 @@ package iplists import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/types" - "strings" ) type DeleteCountAction struct { diff --git a/internal/web/actions/default/servers/iplists/deleteItems.go b/internal/web/actions/default/servers/iplists/deleteItems.go index 70c05d56..41f5dae4 100644 --- a/internal/web/actions/default/servers/iplists/deleteItems.go +++ b/internal/web/actions/default/servers/iplists/deleteItems.go @@ -3,12 +3,13 @@ package iplists import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/types" - "strings" ) type DeleteItemsAction struct { diff --git a/internal/web/actions/default/servers/iplists/exportData.go b/internal/web/actions/default/servers/iplists/exportData.go index 16969ed7..835ef9e3 100644 --- a/internal/web/actions/default/servers/iplists/exportData.go +++ b/internal/web/actions/default/servers/iplists/exportData.go @@ -6,6 +6,8 @@ import ( "bytes" "encoding/csv" "encoding/json" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -13,7 +15,6 @@ import ( "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" "github.com/tealeg/xlsx/v3" - "strconv" ) type ExportDataAction struct { diff --git a/internal/web/actions/default/servers/iplists/import.go b/internal/web/actions/default/servers/iplists/import.go index 91c3dacd..dc83a955 100644 --- a/internal/web/actions/default/servers/iplists/import.go +++ b/internal/web/actions/default/servers/iplists/import.go @@ -6,6 +6,10 @@ import ( "bytes" "encoding/csv" "encoding/json" + "io" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -14,9 +18,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/types" "github.com/tealeg/xlsx/v3" - "io" - "regexp" - "strings" ) type ImportAction struct { diff --git a/internal/web/actions/default/servers/iplists/index.go b/internal/web/actions/default/servers/iplists/index.go index 44ad019c..2b197fdd 100644 --- a/internal/web/actions/default/servers/iplists/index.go +++ b/internal/web/actions/default/servers/iplists/index.go @@ -3,13 +3,14 @@ package iplists import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/iplists/iplistutils/utils.go b/internal/web/actions/default/servers/iplists/iplistutils/utils.go index be776262..a78077c1 100644 --- a/internal/web/actions/default/servers/iplists/iplistutils/utils.go +++ b/internal/web/actions/default/servers/iplists/iplistutils/utils.go @@ -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 iplistutils diff --git a/internal/web/actions/default/servers/iplists/items.go b/internal/web/actions/default/servers/iplists/items.go index e3fb96cb..1b99ff3f 100644 --- a/internal/web/actions/default/servers/iplists/items.go +++ b/internal/web/actions/default/servers/iplists/items.go @@ -3,13 +3,14 @@ package iplists import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type ItemsAction struct { diff --git a/internal/web/actions/default/servers/iplists/unbindHTTPFirewall.go b/internal/web/actions/default/servers/iplists/unbindHTTPFirewall.go index f78ee7cb..93cf546b 100644 --- a/internal/web/actions/default/servers/iplists/unbindHTTPFirewall.go +++ b/internal/web/actions/default/servers/iplists/unbindHTTPFirewall.go @@ -4,6 +4,7 @@ package iplists import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/iplists/utils.go b/internal/web/actions/default/servers/iplists/utils.go index a306ff53..264c798d 100644 --- a/internal/web/actions/default/servers/iplists/utils.go +++ b/internal/web/actions/default/servers/iplists/utils.go @@ -4,6 +4,7 @@ package iplists import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/logs/hasLogs.go b/internal/web/actions/default/servers/logs/hasLogs.go index 84429579..a7a9573e 100644 --- a/internal/web/actions/default/servers/logs/hasLogs.go +++ b/internal/web/actions/default/servers/logs/hasLogs.go @@ -1,13 +1,14 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package logs import ( + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" timeutil "github.com/iwind/TeaGo/utils/time" - "regexp" - "strings" ) // HasLogsAction 检查某个分区是否有日志 diff --git a/internal/web/actions/default/servers/logs/index.go b/internal/web/actions/default/servers/logs/index.go index 5751aa4d..ca9a7d2a 100644 --- a/internal/web/actions/default/servers/logs/index.go +++ b/internal/web/actions/default/servers/logs/index.go @@ -4,15 +4,16 @@ package logs import ( "fmt" + "regexp" + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "regexp" - "strings" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/logs/partitionData.go b/internal/web/actions/default/servers/logs/partitionData.go index c813e6fe..1399fa35 100644 --- a/internal/web/actions/default/servers/logs/partitionData.go +++ b/internal/web/actions/default/servers/logs/partitionData.go @@ -3,9 +3,10 @@ package logs import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "strings" ) // PartitionDataAction 读取分区表 diff --git a/internal/web/actions/default/servers/logs/settings.go b/internal/web/actions/default/servers/logs/settings.go index 70ceb8d5..21f584d3 100644 --- a/internal/web/actions/default/servers/logs/settings.go +++ b/internal/web/actions/default/servers/logs/settings.go @@ -4,6 +4,7 @@ package logs import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/metrics/charts/chartutils/utils.go b/internal/web/actions/default/servers/metrics/charts/chartutils/utils.go index 6abe1e77..18c4d930 100644 --- a/internal/web/actions/default/servers/metrics/charts/chartutils/utils.go +++ b/internal/web/actions/default/servers/metrics/charts/chartutils/utils.go @@ -4,6 +4,7 @@ package chartutils import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/metrics/createPopup.go b/internal/web/actions/default/servers/metrics/createPopup.go index 580df62b..2fd52a08 100644 --- a/internal/web/actions/default/servers/metrics/createPopup.go +++ b/internal/web/actions/default/servers/metrics/createPopup.go @@ -4,6 +4,7 @@ package metrics import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/metrics/metricutils/utils.go b/internal/web/actions/default/servers/metrics/metricutils/utils.go index 6abc60c4..72902b5d 100644 --- a/internal/web/actions/default/servers/metrics/metricutils/utils.go +++ b/internal/web/actions/default/servers/metrics/metricutils/utils.go @@ -4,6 +4,7 @@ package metricutils import ( "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/metrics/stats.go b/internal/web/actions/default/servers/metrics/stats.go index 9f89b6a6..d10c43b0 100644 --- a/internal/web/actions/default/servers/metrics/stats.go +++ b/internal/web/actions/default/servers/metrics/stats.go @@ -4,6 +4,7 @@ package metrics import ( "fmt" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/metrics/metricutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/metrics/update.go b/internal/web/actions/default/servers/metrics/update.go index 100c4585..25933f37 100644 --- a/internal/web/actions/default/servers/metrics/update.go +++ b/internal/web/actions/default/servers/metrics/update.go @@ -4,6 +4,7 @@ package metrics import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/metrics/metricutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/nearby.go b/internal/web/actions/default/servers/nearby.go index 6d556b17..212ce532 100644 --- a/internal/web/actions/default/servers/nearby.go +++ b/internal/web/actions/default/servers/nearby.go @@ -3,11 +3,12 @@ package servers import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) // NearbyAction 查找附近的Server diff --git a/internal/web/actions/default/servers/server/index.go b/internal/web/actions/default/servers/server/index.go index 8e33870a..faea3509 100644 --- a/internal/web/actions/default/servers/server/index.go +++ b/internal/web/actions/default/servers/server/index.go @@ -1,11 +1,12 @@ package server import ( + "strconv" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "strconv" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/log/base.go b/internal/web/actions/default/servers/server/log/base.go index 34398587..e0d46e90 100644 --- a/internal/web/actions/default/servers/server/log/base.go +++ b/internal/web/actions/default/servers/server/log/base.go @@ -1,9 +1,10 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package log import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/log/history.go b/internal/web/actions/default/servers/server/log/history.go index 2ed36b4b..de41ff01 100644 --- a/internal/web/actions/default/servers/server/log/history.go +++ b/internal/web/actions/default/servers/server/log/history.go @@ -1,14 +1,15 @@ package log import ( + "regexp" + "strings" + "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "regexp" - "strings" ) type HistoryAction struct { diff --git a/internal/web/actions/default/servers/server/log/viewPopup.go b/internal/web/actions/default/servers/server/log/viewPopup.go index d9056a31..17ccd000 100644 --- a/internal/web/actions/default/servers/server/log/viewPopup.go +++ b/internal/web/actions/default/servers/server/log/viewPopup.go @@ -1,12 +1,13 @@ package log import ( + "net/http" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "net/http" - "strings" ) type ViewPopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/access/createPopup.go b/internal/web/actions/default/servers/server/settings/access/createPopup.go index aa3ebaa2..cd58cdaa 100644 --- a/internal/web/actions/default/servers/server/settings/access/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/access/createPopup.go @@ -5,6 +5,8 @@ package access import ( "encoding/json" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -12,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" - "strings" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/access/index.go b/internal/web/actions/default/servers/server/settings/access/index.go index d8d18990..096d7390 100644 --- a/internal/web/actions/default/servers/server/settings/access/index.go +++ b/internal/web/actions/default/servers/server/settings/access/index.go @@ -2,6 +2,7 @@ package access import ( "encoding/json" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/access/random.go b/internal/web/actions/default/servers/server/settings/access/random.go index eab9da7e..e26ddbcb 100644 --- a/internal/web/actions/default/servers/server/settings/access/random.go +++ b/internal/web/actions/default/servers/server/settings/access/random.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package access diff --git a/internal/web/actions/default/servers/server/settings/access/updatePopup.go b/internal/web/actions/default/servers/server/settings/access/updatePopup.go index f700b71b..a0c2c0db 100644 --- a/internal/web/actions/default/servers/server/settings/access/updatePopup.go +++ b/internal/web/actions/default/servers/server/settings/access/updatePopup.go @@ -5,6 +5,8 @@ package access import ( "encoding/json" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -13,7 +15,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type UpdatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/cache/createPopup.go b/internal/web/actions/default/servers/server/settings/cache/createPopup.go index 6281d880..3105f0f8 100644 --- a/internal/web/actions/default/servers/server/settings/cache/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/cache/createPopup.go @@ -2,6 +2,7 @@ package cache import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/settings/cache/fetch.go b/internal/web/actions/default/servers/server/settings/cache/fetch.go index 5886b1ec..7fa86ddf 100644 --- a/internal/web/actions/default/servers/server/settings/cache/fetch.go +++ b/internal/web/actions/default/servers/server/settings/cache/fetch.go @@ -3,6 +3,8 @@ package cache import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -12,7 +14,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type FetchAction struct { diff --git a/internal/web/actions/default/servers/server/settings/cache/index.go b/internal/web/actions/default/servers/server/settings/cache/index.go index e7c57aaa..0d619775 100644 --- a/internal/web/actions/default/servers/server/settings/cache/index.go +++ b/internal/web/actions/default/servers/server/settings/cache/index.go @@ -2,6 +2,8 @@ package cache import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" @@ -13,7 +15,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/cache/purge.go b/internal/web/actions/default/servers/server/settings/cache/purge.go index fb8f24c2..a4e0e8f8 100644 --- a/internal/web/actions/default/servers/server/settings/cache/purge.go +++ b/internal/web/actions/default/servers/server/settings/cache/purge.go @@ -2,7 +2,10 @@ package cache -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "strings" ) type PurgeAction struct { diff --git a/internal/web/actions/default/servers/server/settings/cache/updateRefs.go b/internal/web/actions/default/servers/server/settings/cache/updateRefs.go index 64f92ea7..c481cecc 100644 --- a/internal/web/actions/default/servers/server/settings/cache/updateRefs.go +++ b/internal/web/actions/default/servers/server/settings/cache/updateRefs.go @@ -5,6 +5,7 @@ package cache import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/compression/index.go b/internal/web/actions/default/servers/server/settings/compression/index.go index 18bb5378..8fdad63d 100644 --- a/internal/web/actions/default/servers/server/settings/compression/index.go +++ b/internal/web/actions/default/servers/server/settings/compression/index.go @@ -4,6 +4,7 @@ package compression import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/conds/addCondPopup.go b/internal/web/actions/default/servers/server/settings/conds/addCondPopup.go index a7409887..d98fc61a 100644 --- a/internal/web/actions/default/servers/server/settings/conds/addCondPopup.go +++ b/internal/web/actions/default/servers/server/settings/conds/addCondPopup.go @@ -2,6 +2,7 @@ package conds import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds/condutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" diff --git a/internal/web/actions/default/servers/server/settings/conds/addGroupPopup.go b/internal/web/actions/default/servers/server/settings/conds/addGroupPopup.go index 35a12aba..65878e64 100644 --- a/internal/web/actions/default/servers/server/settings/conds/addGroupPopup.go +++ b/internal/web/actions/default/servers/server/settings/conds/addGroupPopup.go @@ -2,6 +2,7 @@ package conds import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds/condutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" diff --git a/internal/web/actions/default/servers/server/settings/conds/condutils/utils.go b/internal/web/actions/default/servers/server/settings/conds/condutils/utils.go index f1b83d49..45545d6d 100644 --- a/internal/web/actions/default/servers/server/settings/conds/condutils/utils.go +++ b/internal/web/actions/default/servers/server/settings/conds/condutils/utils.go @@ -2,11 +2,13 @@ package condutils import ( "encoding/json" + "os" + "path/filepath" + "github.com/iwind/TeaGo/Tea" _ "github.com/iwind/TeaGo/bootstrap" "github.com/iwind/TeaGo/files" "github.com/iwind/TeaGo/logs" - "path/filepath" ) type CondJSComponent struct { @@ -27,6 +29,10 @@ func ReadAllAvailableCondTypes() []*CondJSComponent { if Tea.IsTesting() { dir = filepath.Dir(Tea.Root) + "/web" } + gitDir, gDirFound := os.LookupEnv("GithubDIR") + if gDirFound { + dir = gitDir + "/EdgeAdmin/web" + } dir += "/public/js/conds/" jsonFiles := files.NewFile(dir).List() for _, file := range jsonFiles { diff --git a/internal/web/actions/default/servers/server/settings/dns/updateCNAMEPopup.go b/internal/web/actions/default/servers/server/settings/dns/updateCNAMEPopup.go index bebf5902..7abf5587 100644 --- a/internal/web/actions/default/servers/server/settings/dns/updateCNAMEPopup.go +++ b/internal/web/actions/default/servers/server/settings/dns/updateCNAMEPopup.go @@ -1,14 +1,15 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package dns import ( + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/types" - "regexp" - "strings" ) type UpdateCNAMEPopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/fastcgi/createPopup.go b/internal/web/actions/default/servers/server/settings/fastcgi/createPopup.go index 5c2d20bd..b117f567 100644 --- a/internal/web/actions/default/servers/server/settings/fastcgi/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/fastcgi/createPopup.go @@ -4,13 +4,14 @@ package fastcgi import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "net" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/fastcgi/index.go b/internal/web/actions/default/servers/server/settings/fastcgi/index.go index e3fca19d..d85baea3 100644 --- a/internal/web/actions/default/servers/server/settings/fastcgi/index.go +++ b/internal/web/actions/default/servers/server/settings/fastcgi/index.go @@ -2,6 +2,7 @@ package fastcgi import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/fastcgi/updatePopup.go b/internal/web/actions/default/servers/server/settings/fastcgi/updatePopup.go index 12a3dc8a..4f9c8cd1 100644 --- a/internal/web/actions/default/servers/server/settings/fastcgi/updatePopup.go +++ b/internal/web/actions/default/servers/server/settings/fastcgi/updatePopup.go @@ -4,13 +4,14 @@ package fastcgi import ( "encoding/json" + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "net" ) type UpdatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/headers/createDeletePopup.go b/internal/web/actions/default/servers/server/settings/headers/createDeletePopup.go index be1f429e..fd0a3e0b 100644 --- a/internal/web/actions/default/servers/server/settings/headers/createDeletePopup.go +++ b/internal/web/actions/default/servers/server/settings/headers/createDeletePopup.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/createNonStandardHeaderPopup.go b/internal/web/actions/default/servers/server/settings/headers/createNonStandardHeaderPopup.go index d044f853..f1a8e5e5 100644 --- a/internal/web/actions/default/servers/server/settings/headers/createNonStandardHeaderPopup.go +++ b/internal/web/actions/default/servers/server/settings/headers/createNonStandardHeaderPopup.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/createSetPopup.go b/internal/web/actions/default/servers/server/settings/headers/createSetPopup.go index 0b74eefd..72c22d03 100644 --- a/internal/web/actions/default/servers/server/settings/headers/createSetPopup.go +++ b/internal/web/actions/default/servers/server/settings/headers/createSetPopup.go @@ -2,12 +2,13 @@ package headers import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "strings" ) type CreateSetPopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/headers/delete.go b/internal/web/actions/default/servers/server/settings/headers/delete.go index 4ae297eb..50cf9481 100644 --- a/internal/web/actions/default/servers/server/settings/headers/delete.go +++ b/internal/web/actions/default/servers/server/settings/headers/delete.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/deleteDeletingHeader.go b/internal/web/actions/default/servers/server/settings/headers/deleteDeletingHeader.go index a2fe6bac..e3aa6406 100644 --- a/internal/web/actions/default/servers/server/settings/headers/deleteDeletingHeader.go +++ b/internal/web/actions/default/servers/server/settings/headers/deleteDeletingHeader.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/deleteNonStandardHeader.go b/internal/web/actions/default/servers/server/settings/headers/deleteNonStandardHeader.go index 958354a9..80486625 100644 --- a/internal/web/actions/default/servers/server/settings/headers/deleteNonStandardHeader.go +++ b/internal/web/actions/default/servers/server/settings/headers/deleteNonStandardHeader.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/index.go b/internal/web/actions/default/servers/server/settings/headers/index.go index 6f610890..9aec6887 100644 --- a/internal/web/actions/default/servers/server/settings/headers/index.go +++ b/internal/web/actions/default/servers/server/settings/headers/index.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/headers/updateCORSPopup.go b/internal/web/actions/default/servers/server/settings/headers/updateCORSPopup.go index 77c94a19..c6b52733 100644 --- a/internal/web/actions/default/servers/server/settings/headers/updateCORSPopup.go +++ b/internal/web/actions/default/servers/server/settings/headers/updateCORSPopup.go @@ -1,9 +1,10 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" diff --git a/internal/web/actions/default/servers/server/settings/headers/updateSetPopup.go b/internal/web/actions/default/servers/server/settings/headers/updateSetPopup.go index d0f03320..56fc11e7 100644 --- a/internal/web/actions/default/servers/server/settings/headers/updateSetPopup.go +++ b/internal/web/actions/default/servers/server/settings/headers/updateSetPopup.go @@ -2,12 +2,13 @@ package headers import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "strings" ) type UpdateSetPopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/http/index.go b/internal/web/actions/default/servers/server/settings/http/index.go index 64244b57..50e84756 100644 --- a/internal/web/actions/default/servers/server/settings/http/index.go +++ b/internal/web/actions/default/servers/server/settings/http/index.go @@ -3,6 +3,8 @@ package http import ( "context" "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -13,7 +15,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/https/index.go b/internal/web/actions/default/servers/server/settings/https/index.go index b4d7de57..57e16241 100644 --- a/internal/web/actions/default/servers/server/settings/https/index.go +++ b/internal/web/actions/default/servers/server/settings/https/index.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "errors" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" @@ -15,7 +17,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/https/index_ext.go b/internal/web/actions/default/servers/server/settings/https/index_ext.go index 940aac9d..3aadb2ec 100644 --- a/internal/web/actions/default/servers/server/settings/https/index_ext.go +++ b/internal/web/actions/default/servers/server/settings/https/index_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package https diff --git a/internal/web/actions/default/servers/server/settings/https/requestCertPopup.go b/internal/web/actions/default/servers/server/settings/https/requestCertPopup.go index 8a508d25..948f85d8 100644 --- a/internal/web/actions/default/servers/server/settings/https/requestCertPopup.go +++ b/internal/web/actions/default/servers/server/settings/https/requestCertPopup.go @@ -2,16 +2,20 @@ package https import ( "encoding/json" + "fmt" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" + "math/rand" + "strings" + "sync" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type RequestCertPopupAction struct { @@ -93,6 +97,9 @@ func (this *RequestCertPopupAction) RunPost(params struct { UserId int64 UserEmail string + AsyncCreateCert bool + ProviderCode string + Must *actions.Must CSRF *actionutils.CSRF }) { @@ -126,57 +133,134 @@ func (this *RequestCertPopupAction) RunPost(params struct { "id": acmeUserId, "email": params.UserEmail, } - } else { + } else if !params.AsyncCreateCert { this.Fail("请选择或者填写用户") } - createTaskResp, err := this.RPC().ACMETaskRPC().CreateACMETask(this.AdminContext(), &pb.CreateACMETaskRequest{ - AcmeUserId: acmeUserId, - DnsProviderId: 0, - DnsDomain: "", - Domains: params.ServerNames, - AutoRenew: true, - AuthType: "http", - }) - if err != nil { - this.ErrorPage(err) - return - } - - taskId := createTaskResp.AcmeTaskId - - defer this.CreateLogInfo(codes.ACMETask_LogRunACMETask, taskId) - - runResp, err := this.RPC().ACMETaskRPC().RunACMETask(this.AdminContext(), &pb.RunACMETaskRequest{AcmeTaskId: taskId}) - if err != nil { - this.ErrorPage(err) - return - } - - if runResp.IsOk { - certId := runResp.SslCertId - - configResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{SslCertId: certId}) + if params.AsyncCreateCert && acmeUserId == 0 && params.ProviderCode != "" { + acmeUsersResp, err := this.RPC().ACMEUserRPC().FindAllACMEUsers(this.AdminContext(), &pb.FindAllACMEUsersRequest{}) if err != nil { this.ErrorPage(err) return } - certConfig := &sslconfigs.SSLCertConfig{} - err = json.Unmarshal(configResp.SslCertJSON, certConfig) - if err != nil { - this.ErrorPage(err) - return + var userIds = []int64{} + for _, user := range acmeUsersResp.AcmeUsers { + if user.AcmeProviderCode == params.ProviderCode { + userIds = append(userIds, user.Id) + } } - certConfig.CertData = nil // 去掉不必要的数据 - certConfig.KeyData = nil // 去掉不必要的数据 - this.Data["cert"] = certConfig - this.Data["certRef"] = &sslconfigs.SSLCertRef{ - IsOn: true, - CertId: certId, + if len(userIds) < 5 { + for i := 0; i < 5-len(userIds); i++ { + createUserResp, err := this.RPC().ACMEUserRPC().CreateACMEUser(this.AdminContext(), &pb.CreateACMEUserRequest{ + Email: fmt.Sprintf("%s-acme-%d-@mail.com", params.ProviderCode, rand.Intn(1000)), + AcmeProviderCode: params.ProviderCode, + }) + if err != nil { + this.ErrorPage(err) + return + } + userIds = append(userIds, createUserResp.AcmeUserId) + } } + acmeUserId = userIds[0] + + // 根据主域名拆分 + domainMap := make(map[string][]string) + for _, domain := range params.ServerNames { + parts := strings.Split(domain, ".") + rootDomain := strings.Join(parts[len(parts)-2:], ".") + domainMap[rootDomain] = append(domainMap[rootDomain], domain) + } + + domainsGroup := make([][]string, 0, len(domainMap)) + for _, domains := range domainMap { + domainsGroup = append(domainsGroup, domains) + } + + domainsCount := len(domainsGroup) + var queue = make(chan []string, domainsCount) + for _, domains := range domainsGroup { + queue <- domains + } + var concurrent = 10 + var wg = sync.WaitGroup{} + wg.Add(domainsCount) + sem := make(chan struct{}, concurrent) + for i := 0; i < domainsCount; i++ { + domains := <-queue + sem <- struct{}{} + go func(domains []string) { + defer func() { + <-sem + wg.Done() + }() + createResp, err := this.RPC().ACMETaskRPC().CreateACMETask(this.AdminContext(), &pb.CreateACMETaskRequest{ + AcmeUserId: acmeUserId, + DnsProviderId: 0, + DnsDomain: "", + Domains: domains, + AutoRenew: true, + AuthType: "http", + Async: true, + }) + if err == nil { + this.CreateLogInfo("创建证书申请任务 %d", createResp.AcmeTaskId) + } + }(domains) + } + wg.Wait() this.Success() } else { - this.Fail(runResp.Error) + createTaskResp, err := this.RPC().ACMETaskRPC().CreateACMETask(this.AdminContext(), &pb.CreateACMETaskRequest{ + AcmeUserId: acmeUserId, + DnsProviderId: 0, + DnsDomain: "", + Domains: params.ServerNames, + AutoRenew: true, + AuthType: "http", + Async: false, + }) + if err != nil { + this.ErrorPage(err) + return + } + + taskId := createTaskResp.AcmeTaskId + + defer this.CreateLogInfo(codes.ACMETask_LogRunACMETask, taskId) + + runResp, err := this.RPC().ACMETaskRPC().RunACMETask(this.AdminContext(), &pb.RunACMETaskRequest{AcmeTaskId: taskId}) + if err != nil { + this.ErrorPage(err) + return + } + + if runResp.IsOk { + certId := runResp.SslCertId + + configResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{SslCertId: certId}) + if err != nil { + this.ErrorPage(err) + return + } + certConfig := &sslconfigs.SSLCertConfig{} + err = json.Unmarshal(configResp.SslCertJSON, certConfig) + if err != nil { + this.ErrorPage(err) + return + } + certConfig.CertData = nil // 去掉不必要的数据 + certConfig.KeyData = nil // 去掉不必要的数据 + this.Data["cert"] = certConfig + this.Data["certRef"] = &sslconfigs.SSLCertRef{ + IsOn: true, + CertId: certId, + } + + this.Success() + } else { + this.Fail(runResp.Error) + } } } diff --git a/internal/web/actions/default/servers/server/settings/index.go b/internal/web/actions/default/servers/server/settings/index.go index 1a3b21e6..2514cf93 100644 --- a/internal/web/actions/default/servers/server/settings/index.go +++ b/internal/web/actions/default/servers/server/settings/index.go @@ -3,6 +3,7 @@ package settings import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/index_ext.go b/internal/web/actions/default/servers/server/settings/index_ext.go index b83caffe..028e96a9 100644 --- a/internal/web/actions/default/servers/server/settings/index_ext.go +++ b/internal/web/actions/default/servers/server/settings/index_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package settings diff --git a/internal/web/actions/default/servers/server/settings/locations/access/index.go b/internal/web/actions/default/servers/server/settings/locations/access/index.go index 7ad9bd90..be385381 100644 --- a/internal/web/actions/default/servers/server/settings/locations/access/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/access/index.go @@ -2,6 +2,7 @@ package access import ( "encoding/json" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/locations/cache/index.go b/internal/web/actions/default/servers/server/settings/locations/cache/index.go index 86a9954c..cdd2531d 100644 --- a/internal/web/actions/default/servers/server/settings/locations/cache/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/cache/index.go @@ -2,6 +2,8 @@ package cache import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" @@ -12,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/locations/compression/index.go b/internal/web/actions/default/servers/server/settings/locations/compression/index.go index d4959984..71b84469 100644 --- a/internal/web/actions/default/servers/server/settings/locations/compression/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/compression/index.go @@ -4,6 +4,7 @@ package compression import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/locations/create.go b/internal/web/actions/default/servers/server/settings/locations/create.go index 105fe112..81e5ba50 100644 --- a/internal/web/actions/default/servers/server/settings/locations/create.go +++ b/internal/web/actions/default/servers/server/settings/locations/create.go @@ -2,6 +2,9 @@ package locations import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -9,8 +12,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "regexp" - "strings" ) // CreateAction 创建路由规则 diff --git a/internal/web/actions/default/servers/server/settings/locations/delete.go b/internal/web/actions/default/servers/server/settings/locations/delete.go index 304fe6d9..98266247 100644 --- a/internal/web/actions/default/servers/server/settings/locations/delete.go +++ b/internal/web/actions/default/servers/server/settings/locations/delete.go @@ -2,6 +2,7 @@ package locations import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/locations/fastcgi/index.go b/internal/web/actions/default/servers/server/settings/locations/fastcgi/index.go index ed4ca4c9..8d559403 100644 --- a/internal/web/actions/default/servers/server/settings/locations/fastcgi/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/fastcgi/index.go @@ -2,6 +2,7 @@ package fastcgi import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/locations/headers/index.go b/internal/web/actions/default/servers/server/settings/locations/headers/index.go index 4ab4ea60..37834739 100644 --- a/internal/web/actions/default/servers/server/settings/locations/headers/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/headers/index.go @@ -2,6 +2,7 @@ package headers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/locations/index.go b/internal/web/actions/default/servers/server/settings/locations/index.go index 6e39f9a9..1ccb4547 100644 --- a/internal/web/actions/default/servers/server/settings/locations/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/index.go @@ -2,11 +2,12 @@ package locations import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/maps" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/locations/location/index.go b/internal/web/actions/default/servers/server/settings/locations/location/index.go index 2f0db656..3575ff73 100644 --- a/internal/web/actions/default/servers/server/settings/locations/location/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/location/index.go @@ -2,14 +2,15 @@ package location import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "regexp" - "strings" ) // IndexAction 路由规则详情 diff --git a/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go b/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go index 3076d91b..c0e81594 100644 --- a/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go +++ b/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go @@ -1,13 +1,14 @@ package locationutils import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "net/http" ) type LocationHelper struct { diff --git a/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go b/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go index bf2eeedd..321be74f 100644 --- a/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go +++ b/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/locations/remoteAddr/index.go b/internal/web/actions/default/servers/server/settings/locations/remoteAddr/index.go index f861b8bf..b414ceec 100644 --- a/internal/web/actions/default/servers/server/settings/locations/remoteAddr/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/remoteAddr/index.go @@ -4,13 +4,14 @@ package remoteAddr import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" - "regexp" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/index.go b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/index.go index aa56be32..495d273d 100644 --- a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/index.go @@ -2,6 +2,7 @@ package reverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/scheduling.go b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/scheduling.go index 5d16fd84..80f2a075 100644 --- a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/scheduling.go +++ b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/scheduling.go @@ -3,6 +3,7 @@ package reverseProxy import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go index 949c5691..61cbc437 100644 --- a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go +++ b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go @@ -3,6 +3,7 @@ package reverseProxy import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/locations/sort.go b/internal/web/actions/default/servers/server/settings/locations/sort.go index 50981974..9af0ab28 100644 --- a/internal/web/actions/default/servers/server/settings/locations/sort.go +++ b/internal/web/actions/default/servers/server/settings/locations/sort.go @@ -2,6 +2,7 @@ package locations import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/locations/waf/index.go b/internal/web/actions/default/servers/server/settings/locations/waf/index.go index 4c40de58..7df2f050 100644 --- a/internal/web/actions/default/servers/server/settings/locations/waf/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/waf/index.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/locations/webp/index.go b/internal/web/actions/default/servers/server/settings/locations/webp/index.go index aa407e6c..67e85e84 100644 --- a/internal/web/actions/default/servers/server/settings/locations/webp/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/webp/index.go @@ -4,6 +4,7 @@ package webp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/locations/websocket/index.go b/internal/web/actions/default/servers/server/settings/locations/websocket/index.go index 2a416bfa..92c350ea 100644 --- a/internal/web/actions/default/servers/server/settings/locations/websocket/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/websocket/index.go @@ -2,6 +2,7 @@ package websocket import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/origins/addPopup.go b/internal/web/actions/default/servers/server/settings/origins/addPopup.go index 3b08f897..02e62f95 100644 --- a/internal/web/actions/default/servers/server/settings/origins/addPopup.go +++ b/internal/web/actions/default/servers/server/settings/origins/addPopup.go @@ -3,6 +3,10 @@ package origins import ( "encoding/json" "errors" + "net/url" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -12,9 +16,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "net/url" - "regexp" - "strings" ) // AddPopupAction 添加源站 diff --git a/internal/web/actions/default/servers/server/settings/origins/addPopup_ext.go b/internal/web/actions/default/servers/server/settings/origins/addPopup_ext.go index 05a9b89a..0fbe4844 100644 --- a/internal/web/actions/default/servers/server/settings/origins/addPopup_ext.go +++ b/internal/web/actions/default/servers/server/settings/origins/addPopup_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package origins diff --git a/internal/web/actions/default/servers/server/settings/origins/delete.go b/internal/web/actions/default/servers/server/settings/origins/delete.go index c6d93f23..7c8bf501 100644 --- a/internal/web/actions/default/servers/server/settings/origins/delete.go +++ b/internal/web/actions/default/servers/server/settings/origins/delete.go @@ -3,6 +3,7 @@ package origins import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/origins/detectHTTPS.go b/internal/web/actions/default/servers/server/settings/origins/detectHTTPS.go index 41937ccb..72d3c584 100644 --- a/internal/web/actions/default/servers/server/settings/origins/detectHTTPS.go +++ b/internal/web/actions/default/servers/server/settings/origins/detectHTTPS.go @@ -1,14 +1,15 @@ -// 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 origins import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "net" "net/url" "strings" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/configutils" ) type DetectHTTPSAction struct { diff --git a/internal/web/actions/default/servers/server/settings/origins/updateIsOn.go b/internal/web/actions/default/servers/server/settings/origins/updateIsOn.go index 45624158..21563ab1 100644 --- a/internal/web/actions/default/servers/server/settings/origins/updateIsOn.go +++ b/internal/web/actions/default/servers/server/settings/origins/updateIsOn.go @@ -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 origins diff --git a/internal/web/actions/default/servers/server/settings/origins/updatePopup.go b/internal/web/actions/default/servers/server/settings/origins/updatePopup.go index f186baf5..a764ac6e 100644 --- a/internal/web/actions/default/servers/server/settings/origins/updatePopup.go +++ b/internal/web/actions/default/servers/server/settings/origins/updatePopup.go @@ -2,6 +2,10 @@ package origins import ( "encoding/json" + "net/url" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -12,9 +16,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/url" - "regexp" - "strings" ) // UpdatePopupAction 修改源站 diff --git a/internal/web/actions/default/servers/server/settings/origins/updatePopup_ext.go b/internal/web/actions/default/servers/server/settings/origins/updatePopup_ext.go index 472a33ce..af3eb924 100644 --- a/internal/web/actions/default/servers/server/settings/origins/updatePopup_ext.go +++ b/internal/web/actions/default/servers/server/settings/origins/updatePopup_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package origins diff --git a/internal/web/actions/default/servers/server/settings/pages/createPopup.go b/internal/web/actions/default/servers/server/settings/pages/createPopup.go index aa238a52..6b17afd6 100644 --- a/internal/web/actions/default/servers/server/settings/pages/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/pages/createPopup.go @@ -2,6 +2,7 @@ package pages import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/pages/index.go b/internal/web/actions/default/servers/server/settings/pages/index.go index c7e25f40..7cefee8b 100644 --- a/internal/web/actions/default/servers/server/settings/pages/index.go +++ b/internal/web/actions/default/servers/server/settings/pages/index.go @@ -2,6 +2,8 @@ package pages import ( "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -9,7 +11,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "regexp" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/pages/updatePopup.go b/internal/web/actions/default/servers/server/settings/pages/updatePopup.go index 5b053465..9ad9e6d1 100644 --- a/internal/web/actions/default/servers/server/settings/pages/updatePopup.go +++ b/internal/web/actions/default/servers/server/settings/pages/updatePopup.go @@ -2,6 +2,7 @@ package pages import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/redirects/createPopup.go b/internal/web/actions/default/servers/server/settings/redirects/createPopup.go index 68a8b0ea..d06c479c 100644 --- a/internal/web/actions/default/servers/server/settings/redirects/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/redirects/createPopup.go @@ -2,14 +2,15 @@ package redirects import ( "encoding/json" + "net/url" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" - "net/url" - "regexp" - "strings" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/remoteAddr/index.go b/internal/web/actions/default/servers/server/settings/remoteAddr/index.go index 7413d041..2453db1c 100644 --- a/internal/web/actions/default/servers/server/settings/remoteAddr/index.go +++ b/internal/web/actions/default/servers/server/settings/remoteAddr/index.go @@ -4,14 +4,15 @@ package remoteAddr import ( "encoding/json" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "regexp" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/server/settings/reverseProxy/index.go b/internal/web/actions/default/servers/server/settings/reverseProxy/index.go index f037ab36..10cd50cf 100644 --- a/internal/web/actions/default/servers/server/settings/reverseProxy/index.go +++ b/internal/web/actions/default/servers/server/settings/reverseProxy/index.go @@ -2,6 +2,7 @@ package reverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/settings/reverseProxy/scheduling.go b/internal/web/actions/default/servers/server/settings/reverseProxy/scheduling.go index 2f3b41c5..e40802ba 100644 --- a/internal/web/actions/default/servers/server/settings/reverseProxy/scheduling.go +++ b/internal/web/actions/default/servers/server/settings/reverseProxy/scheduling.go @@ -3,6 +3,7 @@ package reverseProxy import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/server/settings/reverseProxy/setting.go b/internal/web/actions/default/servers/server/settings/reverseProxy/setting.go index 5981aa16..290e29cf 100644 --- a/internal/web/actions/default/servers/server/settings/reverseProxy/setting.go +++ b/internal/web/actions/default/servers/server/settings/reverseProxy/setting.go @@ -3,6 +3,7 @@ package reverseProxy import ( "context" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/servers/server/settings/reverseProxy/updateSchedulingPopup.go b/internal/web/actions/default/servers/server/settings/reverseProxy/updateSchedulingPopup.go index 2933e906..555bcb33 100644 --- a/internal/web/actions/default/servers/server/settings/reverseProxy/updateSchedulingPopup.go +++ b/internal/web/actions/default/servers/server/settings/reverseProxy/updateSchedulingPopup.go @@ -2,6 +2,7 @@ package reverseProxy import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/rewrite/createPopup.go b/internal/web/actions/default/servers/server/settings/rewrite/createPopup.go index cc43ea59..810cd523 100644 --- a/internal/web/actions/default/servers/server/settings/rewrite/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/rewrite/createPopup.go @@ -2,6 +2,8 @@ package rewrite import ( "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -10,7 +12,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "regexp" ) type CreatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/rewrite/delete.go b/internal/web/actions/default/servers/server/settings/rewrite/delete.go index 1081bdb5..cb428ce1 100644 --- a/internal/web/actions/default/servers/server/settings/rewrite/delete.go +++ b/internal/web/actions/default/servers/server/settings/rewrite/delete.go @@ -2,6 +2,7 @@ package rewrite import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/rewrite/sort.go b/internal/web/actions/default/servers/server/settings/rewrite/sort.go index b751fd7e..a528c4ec 100644 --- a/internal/web/actions/default/servers/server/settings/rewrite/sort.go +++ b/internal/web/actions/default/servers/server/settings/rewrite/sort.go @@ -2,6 +2,7 @@ package rewrite import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/rewrite/updatePopup.go b/internal/web/actions/default/servers/server/settings/rewrite/updatePopup.go index c7c8bfaa..aa6cd6ce 100644 --- a/internal/web/actions/default/servers/server/settings/rewrite/updatePopup.go +++ b/internal/web/actions/default/servers/server/settings/rewrite/updatePopup.go @@ -2,6 +2,8 @@ package rewrite import ( "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -9,7 +11,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/types" - "regexp" ) type UpdatePopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/serverNames/index.go b/internal/web/actions/default/servers/server/settings/serverNames/index.go index f0d043f4..a23429d3 100644 --- a/internal/web/actions/default/servers/server/settings/serverNames/index.go +++ b/internal/web/actions/default/servers/server/settings/serverNames/index.go @@ -2,6 +2,8 @@ package serverNames import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -9,7 +11,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "strings" ) // 域名管理 diff --git a/internal/web/actions/default/servers/server/settings/serverNames/index_ext.go b/internal/web/actions/default/servers/server/settings/serverNames/index_ext.go index dd875359..a7a7926a 100644 --- a/internal/web/actions/default/servers/server/settings/serverNames/index_ext.go +++ b/internal/web/actions/default/servers/server/settings/serverNames/index_ext.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package serverNames diff --git a/internal/web/actions/default/servers/server/settings/tcp/index.go b/internal/web/actions/default/servers/server/settings/tcp/index.go index 8189a41b..3bf12021 100644 --- a/internal/web/actions/default/servers/server/settings/tcp/index.go +++ b/internal/web/actions/default/servers/server/settings/tcp/index.go @@ -2,6 +2,7 @@ package tcp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/tls/index.go b/internal/web/actions/default/servers/server/settings/tls/index.go index d16a5721..67b54ea7 100644 --- a/internal/web/actions/default/servers/server/settings/tls/index.go +++ b/internal/web/actions/default/servers/server/settings/tls/index.go @@ -3,6 +3,7 @@ package tls import ( "encoding/json" "errors" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/udp/index.go b/internal/web/actions/default/servers/server/settings/udp/index.go index 58940e4d..9517b7d3 100644 --- a/internal/web/actions/default/servers/server/settings/udp/index.go +++ b/internal/web/actions/default/servers/server/settings/udp/index.go @@ -2,6 +2,7 @@ package udp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/servers/server/settings/waf/group.go b/internal/web/actions/default/servers/server/settings/waf/group.go index 28d5884e..b5909c3c 100644 --- a/internal/web/actions/default/servers/server/settings/waf/group.go +++ b/internal/web/actions/default/servers/server/settings/waf/group.go @@ -1,12 +1,13 @@ package waf import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type GroupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/index.go b/internal/web/actions/default/servers/server/settings/waf/index.go index cd3d5c6c..f66383e7 100644 --- a/internal/web/actions/default/servers/server/settings/waf/index.go +++ b/internal/web/actions/default/servers/server/settings/waf/index.go @@ -2,6 +2,7 @@ package waf import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/waf/init.go b/internal/web/actions/default/servers/server/settings/waf/init.go index 7a1a1962..1f47c600 100644 --- a/internal/web/actions/default/servers/server/settings/waf/init.go +++ b/internal/web/actions/default/servers/server/settings/waf/init.go @@ -21,7 +21,9 @@ func init() { GetPost("/ipadmin/countries", new(ipadmin.CountriesAction)). Get("/ipadmin/selectCountriesPopup", new(ipadmin.SelectCountriesPopupAction)). Get("/ipadmin/selectProvincesPopup", new(ipadmin.SelectProvincesPopupAction)). + Get("/ipadmin/selectProvidersPopup", new(ipadmin.SelectProvidersPopupAction)). GetPost("/ipadmin/provinces", new(ipadmin.ProvincesAction)). + GetPost("/ipadmin/providers", new(ipadmin.ProvidersAction)). GetPost("/ipadmin/updateIPPopup", new(ipadmin.UpdateIPPopupAction)). Post("/ipadmin/deleteIP", new(ipadmin.DeleteIPAction)). GetPost("/ipadmin/test", new(ipadmin.TestAction)). diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/allowList.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/allowList.go index 95e709cf..13290255 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/allowList.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/allowList.go @@ -1,6 +1,8 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -8,7 +10,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ipconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type AllowListAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/countries.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/countries.go index af05b7ee..e6572fc4 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/countries.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/countries.go @@ -2,6 +2,8 @@ package ipadmin import ( "encoding/json" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -11,7 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type CountriesAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/denyList.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/denyList.go index 69e0b691..150aed8f 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/denyList.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/denyList.go @@ -1,6 +1,8 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -8,7 +10,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ipconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type DenyListAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/greyList.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/greyList.go index 1293d004..75008b41 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/greyList.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/greyList.go @@ -1,6 +1,8 @@ package ipadmin import ( + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" @@ -8,7 +10,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ipconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type GreyListAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/providers.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/providers.go new file mode 100644 index 00000000..7d712ab2 --- /dev/null +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/providers.go @@ -0,0 +1,206 @@ +package ipadmin + +import ( + "encoding/json" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" + "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/lists" + "github.com/iwind/TeaGo/maps" +) + +type ProvidersAction struct { + actionutils.ParentAction +} + +func (this *ProvidersAction) Init() { + this.Nav("", "setting", "provider") + this.SecondMenu("waf") +} + +func (this *ProvidersAction) RunGet(params struct { + FirewallPolicyId int64 + ServerId int64 +}) { + this.Data["featureIsOn"] = true + this.Data["firewallPolicyId"] = params.FirewallPolicyId + this.Data["subMenuItem"] = "provider" + + // 当前选中的运营商 + policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId) + if err != nil { + this.ErrorPage(err) + return + } + if policyConfig == nil { + this.NotFound("firewallPolicy", params.FirewallPolicyId) + return + } + + var deniedProviderIds = []int64{} + var allowedProviderIds = []int64{} + var providerHTML string + if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { + deniedProviderIds = policyConfig.Inbound.Region.DenyProviderIds + allowedProviderIds = policyConfig.Inbound.Region.AllowProviderIds + providerHTML = policyConfig.Inbound.Region.ProviderHTML + } + this.Data["providerHTML"] = providerHTML + + providerResp, err := this.RPC().RegionProviderRPC().FindAllRegionProviders(this.AdminContext(), &pb.FindAllRegionProvidersRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + var deniedProviderMaps = []maps.Map{} + var allowedProviderMaps = []maps.Map{} + for _, provider := range providerResp.RegionProviders { + var providerMap = maps.Map{ + "id": provider.Id, + "name": provider.Name, + } + if lists.ContainsInt64(deniedProviderIds, provider.Id) { + deniedProviderMaps = append(deniedProviderMaps, providerMap) + } + if lists.ContainsInt64(allowedProviderIds, provider.Id) { + allowedProviderMaps = append(allowedProviderMaps, providerMap) + } + } + this.Data["deniedProviders"] = deniedProviderMaps + this.Data["allowedProviders"] = allowedProviderMaps + + // except & only URL Patterns + this.Data["exceptURLPatterns"] = []*shared.URLPattern{} + this.Data["onlyURLPatterns"] = []*shared.URLPattern{} + if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { + if len(policyConfig.Inbound.Region.ProviderExceptURLPatterns) > 0 { + this.Data["exceptURLPatterns"] = policyConfig.Inbound.Region.ProviderExceptURLPatterns + } + if len(policyConfig.Inbound.Region.ProviderOnlyURLPatterns) > 0 { + this.Data["onlyURLPatterns"] = policyConfig.Inbound.Region.ProviderOnlyURLPatterns + } + } + + // WAF是否启用 + webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId) + if err != nil { + this.ErrorPage(err) + return + } + this.Data["wafIsOn"] = webConfig.FirewallRef != nil && webConfig.FirewallRef.IsOn + + // 获取当前服务所在集群的WAF设置 + clusterFirewallPolicy, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyWithServerId(this.AdminContext(), params.ServerId) + if err != nil { + this.ErrorPage(err) + return + } + if clusterFirewallPolicy != nil { + this.Data["clusterFirewallPolicy"] = maps.Map{ + "id": clusterFirewallPolicy.Id, + "name": clusterFirewallPolicy.Name, + "isOn": clusterFirewallPolicy.IsOn, + "mode": clusterFirewallPolicy.Mode, + "modeInfo": firewallconfigs.FindFirewallMode(clusterFirewallPolicy.Mode), + } + } else { + this.Data["clusterFirewallPolicy"] = nil + } + + this.Show() +} + +func (this *ProvidersAction) RunPost(params struct { + FirewallPolicyId int64 + + DenyProviderIds []int64 + AllowProviderIds []int64 + + ExceptURLPatternsJSON []byte + OnlyURLPatternsJSON []byte + + ProviderHTML string + + Must *actions.Must +}) { + // 日志 + defer this.CreateLogInfo(codes.WAF_LogUpdateForbiddenProviders, params.FirewallPolicyId) + + policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId) + if err != nil { + this.ErrorPage(err) + return + } + if policyConfig == nil { + this.NotFound("firewallPolicy", params.FirewallPolicyId) + return + } + + if policyConfig.Inbound == nil { + policyConfig.Inbound = &firewallconfigs.HTTPFirewallInboundConfig{IsOn: true} + } + if policyConfig.Inbound.Region == nil { + policyConfig.Inbound.Region = &firewallconfigs.HTTPFirewallRegionConfig{ + IsOn: true, + } + } + policyConfig.Inbound.Region.DenyProviderIds = params.DenyProviderIds + policyConfig.Inbound.Region.AllowProviderIds = params.AllowProviderIds + + // 例外URL + var exceptURLPatterns = []*shared.URLPattern{} + if len(params.ExceptURLPatternsJSON) > 0 { + err = json.Unmarshal(params.ExceptURLPatternsJSON, &exceptURLPatterns) + if err != nil { + this.Fail("校验例外URL参数失败:" + err.Error()) + return + } + } + policyConfig.Inbound.Region.ProviderExceptURLPatterns = exceptURLPatterns + + // 限制URL + var onlyURLPatterns = []*shared.URLPattern{} + if len(params.OnlyURLPatternsJSON) > 0 { + err = json.Unmarshal(params.OnlyURLPatternsJSON, &onlyURLPatterns) + if err != nil { + this.Fail("校验限制URL参数失败:" + err.Error()) + return + } + } + policyConfig.Inbound.Region.ProviderOnlyURLPatterns = onlyURLPatterns + + // 自定义提示 + if len(params.ProviderHTML) > 32<<10 { + this.Fail("提示内容长度不能超出32K") + return + } + policyConfig.Inbound.Region.ProviderHTML = params.ProviderHTML + + err = policyConfig.Init() + if err != nil { + this.Fail("配置校验失败:" + err.Error()) + return + } + + inboundJSON, err := json.Marshal(policyConfig.Inbound) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().HTTPFirewallPolicyRPC().UpdateHTTPFirewallInboundConfig(this.AdminContext(), &pb.UpdateHTTPFirewallInboundConfigRequest{ + HttpFirewallPolicyId: params.FirewallPolicyId, + InboundJSON: inboundJSON, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/provinces.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/provinces.go index d9f8ac5b..8837cffc 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/provinces.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/provinces.go @@ -2,6 +2,7 @@ package ipadmin import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectCountriesPopup.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectCountriesPopup.go index a1357ac6..c506a8e3 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectCountriesPopup.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectCountriesPopup.go @@ -1,14 +1,15 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ipadmin import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type SelectCountriesPopupAction struct { diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvidersPopup.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvidersPopup.go new file mode 100644 index 00000000..0b34c2a2 --- /dev/null +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvidersPopup.go @@ -0,0 +1,44 @@ +package ipadmin + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/utils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/iwind/TeaGo/lists" + "github.com/iwind/TeaGo/maps" +) + +type SelectProvidersPopupAction struct { + actionutils.ParentAction +} + +func (this *SelectProvidersPopupAction) Init() { + this.Nav("", "", "") +} + +func (this *SelectProvidersPopupAction) RunGet(params struct { + Type string + SelectedProviderIds string +}) { + this.Data["type"] = params.Type + + var selectedProviderIds = utils.SplitNumbers(params.SelectedProviderIds) + + providersResp, err := this.RPC().RegionProviderRPC().FindAllRegionProviders(this.AdminContext(), &pb.FindAllRegionProvidersRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + + var providerMaps = []maps.Map{} + for _, provider := range providersResp.RegionProviders { + providerMaps = append(providerMaps, maps.Map{ + "id": provider.Id, + "name": provider.Name, + "isChecked": lists.ContainsInt64(selectedProviderIds, provider.Id), + }) + } + this.Data["providers"] = providerMaps + + this.Show() +} diff --git a/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvincesPopup.go b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvincesPopup.go index 28db774c..8d3f8beb 100644 --- a/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvincesPopup.go +++ b/internal/web/actions/default/servers/server/settings/waf/ipadmin/selectProvincesPopup.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ipadmin diff --git a/internal/web/actions/default/servers/server/settings/webp/index.go b/internal/web/actions/default/servers/server/settings/webp/index.go index c5cc5598..f51093bc 100644 --- a/internal/web/actions/default/servers/server/settings/webp/index.go +++ b/internal/web/actions/default/servers/server/settings/webp/index.go @@ -4,6 +4,7 @@ package webp import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/settings/websocket/index.go b/internal/web/actions/default/servers/server/settings/websocket/index.go index ad81746e..1a6b1d79 100644 --- a/internal/web/actions/default/servers/server/settings/websocket/index.go +++ b/internal/web/actions/default/servers/server/settings/websocket/index.go @@ -2,6 +2,7 @@ package websocket import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" diff --git a/internal/web/actions/default/servers/server/stat/dailyRequests.go b/internal/web/actions/default/servers/server/stat/dailyRequests.go index 405a13ff..2655122b 100644 --- a/internal/web/actions/default/servers/server/stat/dailyRequests.go +++ b/internal/web/actions/default/servers/server/stat/dailyRequests.go @@ -3,10 +3,11 @@ package stat import ( + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "sort" ) type DailyRequestsAction struct { diff --git a/internal/web/actions/default/servers/server/stat/hourlyRequests.go b/internal/web/actions/default/servers/server/stat/hourlyRequests.go index 738b3923..6ebd7aaa 100644 --- a/internal/web/actions/default/servers/server/stat/hourlyRequests.go +++ b/internal/web/actions/default/servers/server/stat/hourlyRequests.go @@ -3,10 +3,11 @@ package stat import ( + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "sort" ) type HourlyRequestsAction struct { diff --git a/internal/web/actions/default/servers/server/stat/index.go b/internal/web/actions/default/servers/server/stat/index.go index 50bdb04a..ca44dca3 100644 --- a/internal/web/actions/default/servers/server/stat/index.go +++ b/internal/web/actions/default/servers/server/stat/index.go @@ -3,10 +3,11 @@ package stat import ( + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "sort" ) type IndexAction struct { diff --git a/internal/web/actions/default/servers/serverNamesPopup.go b/internal/web/actions/default/servers/serverNamesPopup.go index b2c550ee..af151def 100644 --- a/internal/web/actions/default/servers/serverNamesPopup.go +++ b/internal/web/actions/default/servers/serverNamesPopup.go @@ -2,6 +2,7 @@ package servers import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" diff --git a/internal/web/actions/default/servers/serverutils/server_helper.go b/internal/web/actions/default/servers/serverutils/server_helper.go index 067924d6..a03b49e6 100644 --- a/internal/web/actions/default/servers/serverutils/server_helper.go +++ b/internal/web/actions/default/servers/serverutils/server_helper.go @@ -3,6 +3,9 @@ package serverutils import ( "encoding/json" "errors" + "net/http" + "strconv" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -14,8 +17,6 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net/http" - "strconv" ) type ServerHelper struct { diff --git a/internal/web/actions/default/servers/serverutils/utils.go b/internal/web/actions/default/servers/serverutils/utils.go index 2e03fb99..bb830532 100644 --- a/internal/web/actions/default/servers/serverutils/utils.go +++ b/internal/web/actions/default/servers/serverutils/utils.go @@ -2,10 +2,11 @@ package serverutils import ( "errors" + "strconv" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "strconv" ) // FindServer 查找服务信息 diff --git a/internal/web/actions/default/servers/status.go b/internal/web/actions/default/servers/status.go index 133f8c4c..d8480a5e 100644 --- a/internal/web/actions/default/servers/status.go +++ b/internal/web/actions/default/servers/status.go @@ -2,13 +2,14 @@ package servers import ( "encoding/json" + "sync" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/maps" - "sync" ) type StatusAction struct { diff --git a/internal/web/actions/default/settings/api/index.go b/internal/web/actions/default/settings/api/index.go index c20db616..5221eacd 100644 --- a/internal/web/actions/default/settings/api/index.go +++ b/internal/web/actions/default/settings/api/index.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "fmt" + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/apinodeutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -14,7 +16,6 @@ import ( "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" timeutil "github.com/iwind/TeaGo/utils/time" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/settings/api/methodStats.go b/internal/web/actions/default/settings/api/methodStats.go index 44b7c006..95a3ea5c 100644 --- a/internal/web/actions/default/settings/api/methodStats.go +++ b/internal/web/actions/default/settings/api/methodStats.go @@ -3,12 +3,13 @@ package api import ( + "sort" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "sort" - "strings" ) type MethodStatsAction struct { diff --git a/internal/web/actions/default/settings/api/node/createAddrPopup.go b/internal/web/actions/default/settings/api/node/createAddrPopup.go index 5e527e9a..4ea4fb34 100644 --- a/internal/web/actions/default/settings/api/node/createAddrPopup.go +++ b/internal/web/actions/default/settings/api/node/createAddrPopup.go @@ -1,13 +1,14 @@ package node import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "github.com/iwind/TeaGo/actions" "net" "net/url" "regexp" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" + "github.com/iwind/TeaGo/actions" ) // CreateAddrPopupAction 添加地址 diff --git a/internal/web/actions/default/settings/api/node/createPopup.go b/internal/web/actions/default/settings/api/node/createPopup.go index 01ef43f3..b50b3bc3 100644 --- a/internal/web/actions/default/settings/api/node/createPopup.go +++ b/internal/web/actions/default/settings/api/node/createPopup.go @@ -2,6 +2,7 @@ package node import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/settings/api/node/helper.go b/internal/web/actions/default/settings/api/node/helper.go index 689a22cc..c89e7528 100644 --- a/internal/web/actions/default/settings/api/node/helper.go +++ b/internal/web/actions/default/settings/api/node/helper.go @@ -1,8 +1,9 @@ package node import ( - "github.com/iwind/TeaGo/actions" "net/http" + + "github.com/iwind/TeaGo/actions" ) type Helper struct { diff --git a/internal/web/actions/default/settings/api/node/index.go b/internal/web/actions/default/settings/api/node/index.go index 5feaed18..27e34f8e 100644 --- a/internal/web/actions/default/settings/api/node/index.go +++ b/internal/web/actions/default/settings/api/node/index.go @@ -3,6 +3,8 @@ package node import ( "encoding/json" "fmt" + "time" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -12,7 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" - "time" ) type IndexAction struct { diff --git a/internal/web/actions/default/settings/api/node/install.go b/internal/web/actions/default/settings/api/node/install.go index dafbb752..86e77b58 100644 --- a/internal/web/actions/default/settings/api/node/install.go +++ b/internal/web/actions/default/settings/api/node/install.go @@ -1,11 +1,12 @@ package node import ( + "os" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/maps" - "os" ) type InstallAction struct { diff --git a/internal/web/actions/default/settings/api/node/update.go b/internal/web/actions/default/settings/api/node/update.go index 2506c2d4..dfbe72bb 100644 --- a/internal/web/actions/default/settings/api/node/update.go +++ b/internal/web/actions/default/settings/api/node/update.go @@ -2,6 +2,7 @@ package node import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/settings/api/node/updateAddrPopup.go b/internal/web/actions/default/settings/api/node/updateAddrPopup.go index fd0719bb..c7e47709 100644 --- a/internal/web/actions/default/settings/api/node/updateAddrPopup.go +++ b/internal/web/actions/default/settings/api/node/updateAddrPopup.go @@ -1,13 +1,14 @@ package node import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "github.com/iwind/TeaGo/actions" "net" "net/url" "regexp" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" + "github.com/iwind/TeaGo/actions" ) type UpdateAddrPopupAction struct { diff --git a/internal/web/actions/default/settings/api/node/upgradeCheck.go b/internal/web/actions/default/settings/api/node/upgradeCheck.go index ce0d336c..6c75f9c0 100644 --- a/internal/web/actions/default/settings/api/node/upgradeCheck.go +++ b/internal/web/actions/default/settings/api/node/upgradeCheck.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package node diff --git a/internal/web/actions/default/settings/api/node/upgradePopup.go b/internal/web/actions/default/settings/api/node/upgradePopup.go index 102ece22..90d1f273 100644 --- a/internal/web/actions/default/settings/api/node/upgradePopup.go +++ b/internal/web/actions/default/settings/api/node/upgradePopup.go @@ -1,17 +1,18 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package node import ( "encoding/json" "errors" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/apinodeutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" - "strings" ) type UpgradePopupAction struct { diff --git a/internal/web/actions/default/settings/database/clean.go b/internal/web/actions/default/settings/database/clean.go index e582dad3..d8f33eac 100644 --- a/internal/web/actions/default/settings/database/clean.go +++ b/internal/web/actions/default/settings/database/clean.go @@ -1,12 +1,13 @@ package database import ( + "sort" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "sort" ) type CleanAction struct { diff --git a/internal/web/actions/default/settings/database/cleanSetting.go b/internal/web/actions/default/settings/database/cleanSetting.go index 9db4d070..5c7cecdf 100644 --- a/internal/web/actions/default/settings/database/cleanSetting.go +++ b/internal/web/actions/default/settings/database/cleanSetting.go @@ -2,6 +2,7 @@ package database import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/settings/database/index.go b/internal/web/actions/default/settings/database/index.go index 98a54656..bdeaa077 100644 --- a/internal/web/actions/default/settings/database/index.go +++ b/internal/web/actions/default/settings/database/index.go @@ -1,6 +1,10 @@ package database import ( + "net" + "os" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/go-sql-driver/mysql" @@ -8,9 +12,6 @@ import ( "github.com/iwind/TeaGo/dbs" "github.com/iwind/TeaGo/maps" "gopkg.in/yaml.v3" - "net" - "os" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/settings/database/update.go b/internal/web/actions/default/settings/database/update.go index c05dab55..ff35aa65 100644 --- a/internal/web/actions/default/settings/database/update.go +++ b/internal/web/actions/default/settings/database/update.go @@ -2,6 +2,11 @@ package database import ( "fmt" + "net" + "os" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" @@ -12,10 +17,6 @@ import ( "github.com/iwind/TeaGo/dbs" "github.com/iwind/TeaGo/maps" "gopkg.in/yaml.v3" - "net" - "os" - "regexp" - "strings" ) type UpdateAction struct { diff --git a/internal/web/actions/default/settings/lang/switch.go b/internal/web/actions/default/settings/lang/switch.go index 132e4928..b021af0e 100644 --- a/internal/web/actions/default/settings/lang/switch.go +++ b/internal/web/actions/default/settings/lang/switch.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package lang diff --git a/internal/web/actions/default/settings/security/dismissXFFPrompt.go b/internal/web/actions/default/settings/security/dismissXFFPrompt.go index a2135c70..7bcb2db8 100644 --- a/internal/web/actions/default/settings/security/dismissXFFPrompt.go +++ b/internal/web/actions/default/settings/security/dismissXFFPrompt.go @@ -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 security diff --git a/internal/web/actions/default/settings/security/index.go b/internal/web/actions/default/settings/security/index.go index 1b032fe9..ec55c0dc 100644 --- a/internal/web/actions/default/settings/security/index.go +++ b/internal/web/actions/default/settings/security/index.go @@ -2,6 +2,7 @@ package security import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/settings/server/admin-server-utils/utils.go b/internal/web/actions/default/settings/server/admin-server-utils/utils.go index fe92f987..9b6d6684 100644 --- a/internal/web/actions/default/settings/server/admin-server-utils/utils.go +++ b/internal/web/actions/default/settings/server/admin-server-utils/utils.go @@ -2,13 +2,14 @@ package adminserverutils import ( "errors" + "net" + "os" + "time" + "github.com/iwind/TeaGo" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/types" "gopkg.in/yaml.v3" - "net" - "os" - "time" ) var ServerConfigIsChanged = false diff --git a/internal/web/actions/default/settings/server/updateHTTPPopup.go b/internal/web/actions/default/settings/server/updateHTTPPopup.go index 1c942bb2..9beb89f6 100644 --- a/internal/web/actions/default/settings/server/updateHTTPPopup.go +++ b/internal/web/actions/default/settings/server/updateHTTPPopup.go @@ -1,12 +1,13 @@ package server import ( + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" adminserverutils "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/server/admin-server-utils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/iwind/TeaGo/actions" - "net" ) type UpdateHTTPPopupAction struct { diff --git a/internal/web/actions/default/settings/server/updateHTTPSPopup.go b/internal/web/actions/default/settings/server/updateHTTPSPopup.go index 966a9ec0..471b8964 100644 --- a/internal/web/actions/default/settings/server/updateHTTPSPopup.go +++ b/internal/web/actions/default/settings/server/updateHTTPSPopup.go @@ -3,6 +3,9 @@ package server import ( "context" "encoding/json" + "net" + "os" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" adminserverutils "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/server/admin-server-utils" @@ -11,8 +14,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/actions" - "net" - "os" ) type UpdateHTTPSPopupAction struct { diff --git a/internal/web/actions/default/settings/transfer/updateHosts.go b/internal/web/actions/default/settings/transfer/updateHosts.go index 33cc3fa9..75f70645 100644 --- a/internal/web/actions/default/settings/transfer/updateHosts.go +++ b/internal/web/actions/default/settings/transfer/updateHosts.go @@ -5,6 +5,7 @@ package transfer import ( "bytes" "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" diff --git a/internal/web/actions/default/settings/transfer/upgradeNodes.go b/internal/web/actions/default/settings/transfer/upgradeNodes.go index 3c54eebe..6a653997 100644 --- a/internal/web/actions/default/settings/transfer/upgradeNodes.go +++ b/internal/web/actions/default/settings/transfer/upgradeNodes.go @@ -4,6 +4,7 @@ package transfer import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/messageconfigs" diff --git a/internal/web/actions/default/settings/transfer/validateAPI.go b/internal/web/actions/default/settings/transfer/validateAPI.go index 8c12695c..cbdddc58 100644 --- a/internal/web/actions/default/settings/transfer/validateAPI.go +++ b/internal/web/actions/default/settings/transfer/validateAPI.go @@ -4,6 +4,8 @@ package transfer import ( "encoding/json" + "regexp" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -14,7 +16,6 @@ import ( "github.com/iwind/TeaGo/lists" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "regexp" ) type ValidateAPIAction struct { diff --git a/internal/web/actions/default/settings/ui/index.go b/internal/web/actions/default/settings/ui/index.go index 14e631e4..97bc5270 100644 --- a/internal/web/actions/default/settings/ui/index.go +++ b/internal/web/actions/default/settings/ui/index.go @@ -1,6 +1,8 @@ package ui import ( + "io" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" @@ -8,7 +10,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/userconfigs" "github.com/iwind/TeaGo/actions" - "io" ) type IndexAction struct { diff --git a/internal/web/actions/default/settings/ui/index_ext.go b/internal/web/actions/default/settings/ui/index_ext.go index bea030bd..218867fc 100644 --- a/internal/web/actions/default/settings/ui/index_ext.go +++ b/internal/web/actions/default/settings/ui/index_ext.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . //go:build !plus package ui diff --git a/internal/web/actions/default/settings/updates/ignoreVersion.go b/internal/web/actions/default/settings/updates/ignoreVersion.go index aa67887b..9fd09ee1 100644 --- a/internal/web/actions/default/settings/updates/ignoreVersion.go +++ b/internal/web/actions/default/settings/updates/ignoreVersion.go @@ -1,9 +1,10 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package updates import ( "encoding/json" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/settings/updates/index.go b/internal/web/actions/default/settings/updates/index.go index 2a729157..e6ebf4ab 100644 --- a/internal/web/actions/default/settings/updates/index.go +++ b/internal/web/actions/default/settings/updates/index.go @@ -5,16 +5,17 @@ package updates import ( "encoding/json" "fmt" + "io" + "net/http" + "runtime" + "strings" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" - "io" - "net/http" - "runtime" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/settings/updates/resetIgnoredVersion.go b/internal/web/actions/default/settings/updates/resetIgnoredVersion.go index f0b5b075..c37759bb 100644 --- a/internal/web/actions/default/settings/updates/resetIgnoredVersion.go +++ b/internal/web/actions/default/settings/updates/resetIgnoredVersion.go @@ -1,9 +1,10 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package updates import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/settings/updates/update.go b/internal/web/actions/default/settings/updates/update.go index 33841038..675cec45 100644 --- a/internal/web/actions/default/settings/updates/update.go +++ b/internal/web/actions/default/settings/updates/update.go @@ -4,6 +4,7 @@ package updates import ( "encoding/json" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" diff --git a/internal/web/actions/default/settings/updates/updateutils/utils.go b/internal/web/actions/default/settings/updates/updateutils/utils.go index b66549fc..26c1edef 100644 --- a/internal/web/actions/default/settings/updates/updateutils/utils.go +++ b/internal/web/actions/default/settings/updates/updateutils/utils.go @@ -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 updateutils @@ -6,12 +6,13 @@ import ( "bytes" "context" "encoding/json" + "os" + "os/exec" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" - "os" - "os/exec" ) func CheckLocalAPINode(rpcClient *rpc.RPCClient, ctx context.Context) (exePath string, ok bool) { diff --git a/internal/web/actions/default/settings/updates/upgrade.go b/internal/web/actions/default/settings/updates/upgrade.go index c14b3aa3..639b937f 100644 --- a/internal/web/actions/default/settings/updates/upgrade.go +++ b/internal/web/actions/default/settings/updates/upgrade.go @@ -1,16 +1,17 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package updates import ( "fmt" + "os" + "os/exec" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/updates/updateutils" - "os" - "os/exec" - "time" ) var upgradeProgress float32 diff --git a/internal/web/actions/default/setup/checkLocalIP.go b/internal/web/actions/default/setup/checkLocalIP.go index 28ccc277..5f17a7a8 100644 --- a/internal/web/actions/default/setup/checkLocalIP.go +++ b/internal/web/actions/default/setup/checkLocalIP.go @@ -1,11 +1,12 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package setup import ( + "net" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "net" ) // CheckLocalIPAction 检查IP是否为局域网IP diff --git a/internal/web/actions/default/setup/confirm/index.go b/internal/web/actions/default/setup/confirm/index.go index 38129db8..d6d18e0f 100644 --- a/internal/web/actions/default/setup/confirm/index.go +++ b/internal/web/actions/default/setup/confirm/index.go @@ -3,14 +3,15 @@ package confirm import ( + "net/url" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/actions" - "net/url" - "strings" ) type IndexAction struct { diff --git a/internal/web/actions/default/setup/detectDB.go b/internal/web/actions/default/setup/detectDB.go index 325620cd..c2ba9849 100644 --- a/internal/web/actions/default/setup/detectDB.go +++ b/internal/web/actions/default/setup/detectDB.go @@ -3,16 +3,17 @@ package setup import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/configutils" - "github.com/iwind/TeaGo/dbs" - "github.com/iwind/TeaGo/maps" "net" "net/url" "os" "runtime" "strings" "time" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/configutils" + "github.com/iwind/TeaGo/dbs" + "github.com/iwind/TeaGo/maps" ) // DetectDBAction 尝试从本地服务器中发现MySQL diff --git a/internal/web/actions/default/setup/index.go b/internal/web/actions/default/setup/index.go index 89536b19..400e6948 100644 --- a/internal/web/actions/default/setup/index.go +++ b/internal/web/actions/default/setup/index.go @@ -1,9 +1,10 @@ package setup import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "net" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" ) type IndexAction struct { diff --git a/internal/web/actions/default/setup/install.go b/internal/web/actions/default/setup/install.go index b517ed4f..eff3b058 100644 --- a/internal/web/actions/default/setup/install.go +++ b/internal/web/actions/default/setup/install.go @@ -3,6 +3,12 @@ package setup import ( "bytes" "encoding/json" + "io" + "os" + "os/exec" + "strings" + "time" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/nodes" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" @@ -16,11 +22,6 @@ import ( "github.com/iwind/TeaGo/maps" "github.com/iwind/gosock/pkg/gosock" "gopkg.in/yaml.v3" - "io" - "os" - "os/exec" - "strings" - "time" ) type InstallAction struct { diff --git a/internal/web/actions/default/setup/mysql/installLogs.go b/internal/web/actions/default/setup/mysql/installLogs.go index 89b240a9..c293a6f4 100644 --- a/internal/web/actions/default/setup/mysql/installLogs.go +++ b/internal/web/actions/default/setup/mysql/installLogs.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package mysql diff --git a/internal/web/actions/default/setup/mysql/installPopup.go b/internal/web/actions/default/setup/mysql/installPopup.go index 0de32d2c..79981ce9 100644 --- a/internal/web/actions/default/setup/mysql/installPopup.go +++ b/internal/web/actions/default/setup/mysql/installPopup.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package mysql diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go index b3858dd9..72053f16 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package mysqlinstallers @@ -7,10 +7,6 @@ import ( "crypto/rand" "errors" "fmt" - executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/setup/mysql/mysqlinstallers/utils" - stringutil "github.com/iwind/TeaGo/utils/string" - timeutil "github.com/iwind/TeaGo/utils/time" "io" "net" "net/http" @@ -22,6 +18,11 @@ import ( "strconv" "strings" "time" + + executils "github.com/TeaOSLab/EdgeAdmin/internal/utils/exec" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/setup/mysql/mysqlinstallers/utils" + stringutil "github.com/iwind/TeaGo/utils/string" + timeutil "github.com/iwind/TeaGo/utils/time" ) type MySQLInstaller struct { diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/cmd.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/cmd.go index 9e17a611..9a6c02e5 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/cmd.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/cmd.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/logger.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/logger.go index bc0ae73c..7b70e8ee 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/logger.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/logger.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/proc.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/proc.go index c7ac0bc4..c14ae3e0 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/proc.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/proc.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils diff --git a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/writer_progress.go b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/writer_progress.go index ef7e93b3..f73533f3 100644 --- a/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/writer_progress.go +++ b/internal/web/actions/default/setup/mysql/mysqlinstallers/utils/writer_progress.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package utils diff --git a/internal/web/actions/default/setup/validateAdmin.go b/internal/web/actions/default/setup/validateAdmin.go index 8410dfd1..c626a534 100644 --- a/internal/web/actions/default/setup/validateAdmin.go +++ b/internal/web/actions/default/setup/validateAdmin.go @@ -1,10 +1,11 @@ package setup import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type ValidateAdminAction struct { diff --git a/internal/web/actions/default/setup/validateApi.go b/internal/web/actions/default/setup/validateApi.go index e6643b46..c07b7d49 100644 --- a/internal/web/actions/default/setup/validateApi.go +++ b/internal/web/actions/default/setup/validateApi.go @@ -1,6 +1,10 @@ package setup import ( + "net" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" @@ -9,9 +13,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" - "net" - "regexp" - "strings" ) type ValidateApiAction struct { diff --git a/internal/web/actions/default/setup/validateDb.go b/internal/web/actions/default/setup/validateDb.go index bd171a44..1f58b698 100644 --- a/internal/web/actions/default/setup/validateDb.go +++ b/internal/web/actions/default/setup/validateDb.go @@ -1,6 +1,11 @@ package setup import ( + "net" + "net/url" + "regexp" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" _ "github.com/go-sql-driver/mysql" @@ -8,10 +13,6 @@ import ( "github.com/iwind/TeaGo/dbs" "github.com/iwind/TeaGo/maps" stringutil "github.com/iwind/TeaGo/utils/string" - "net" - "net/url" - "regexp" - "strings" ) type ValidateDbAction struct { @@ -58,7 +59,7 @@ func (this *ValidateDbAction) RunPost(params struct { // 测试连接 db, err := dbs.NewInstanceFromConfig(&dbs.DBConfig{ Driver: "mysql", - Dsn: url.QueryEscape(params.Username) + ":" + url.QueryEscape(params.Password) + "@tcp(" + configutils.QuoteIP(params.Host) + ":" + params.Port + ")/" + params.Database, + Dsn: url.QueryEscape(params.Username) + ":" + params.Password + "@tcp(" + configutils.QuoteIP(params.Host) + ":" + params.Port + ")/" + params.Database, Prefix: "", }) if err != nil { diff --git a/internal/web/actions/default/ui/cityOptions.go b/internal/web/actions/default/ui/cityOptions.go index a0ff3e3f..0c602b70 100644 --- a/internal/web/actions/default/ui/cityOptions.go +++ b/internal/web/actions/default/ui/cityOptions.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ui diff --git a/internal/web/actions/default/ui/components.go b/internal/web/actions/default/ui/components.go index 2c7dbfd8..a427c879 100644 --- a/internal/web/actions/default/ui/components.go +++ b/internal/web/actions/default/ui/components.go @@ -5,6 +5,8 @@ import ( "crypto/md5" "encoding/json" "fmt" + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds/condutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" @@ -15,7 +17,6 @@ import ( "github.com/iwind/TeaGo/files" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" - "net/http" ) type ComponentsAction actions.Action diff --git a/internal/web/actions/default/ui/countryOptions.go b/internal/web/actions/default/ui/countryOptions.go index f23f9598..46aa01ac 100644 --- a/internal/web/actions/default/ui/countryOptions.go +++ b/internal/web/actions/default/ui/countryOptions.go @@ -1,14 +1,15 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ui import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/regionconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type CountryOptionsAction struct { diff --git a/internal/web/actions/default/ui/hideTip.go b/internal/web/actions/default/ui/hideTip.go index 1bc18d87..1c369565 100644 --- a/internal/web/actions/default/ui/hideTip.go +++ b/internal/web/actions/default/ui/hideTip.go @@ -4,9 +4,10 @@ package ui import ( "encoding/json" + "os" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/Tea" - "os" ) type HideTipAction struct { diff --git a/internal/web/actions/default/ui/image.go b/internal/web/actions/default/ui/image.go index ad3b50cc..f8445b02 100644 --- a/internal/web/actions/default/ui/image.go +++ b/internal/web/actions/default/ui/image.go @@ -1,11 +1,12 @@ package ui import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "mime" "path/filepath" "strconv" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" ) // 公开的图片,不需要检查用户权限 diff --git a/internal/web/actions/default/ui/providerOptions.go b/internal/web/actions/default/ui/providerOptions.go index ab994b0d..42cece67 100644 --- a/internal/web/actions/default/ui/providerOptions.go +++ b/internal/web/actions/default/ui/providerOptions.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ui diff --git a/internal/web/actions/default/ui/provinceOptions.go b/internal/web/actions/default/ui/provinceOptions.go index dd2794d8..4b572c02 100644 --- a/internal/web/actions/default/ui/provinceOptions.go +++ b/internal/web/actions/default/ui/provinceOptions.go @@ -1,4 +1,4 @@ -// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package ui diff --git a/internal/web/actions/default/ui/selectCountriesPopup.go b/internal/web/actions/default/ui/selectCountriesPopup.go index b53f0f3b..3a71c3ea 100644 --- a/internal/web/actions/default/ui/selectCountriesPopup.go +++ b/internal/web/actions/default/ui/selectCountriesPopup.go @@ -1,13 +1,14 @@ package ui import ( + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strings" ) type SelectCountriesPopupAction struct { diff --git a/internal/web/actions/default/ui/showTip.go b/internal/web/actions/default/ui/showTip.go index 429c29f6..3dddfed2 100644 --- a/internal/web/actions/default/ui/showTip.go +++ b/internal/web/actions/default/ui/showTip.go @@ -4,11 +4,12 @@ package ui import ( "encoding/json" + "os" + "sync" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo" "github.com/iwind/TeaGo/Tea" - "os" - "sync" ) var tipKeyMap = map[string]bool{} diff --git a/internal/web/actions/default/ui/validateIPs.go b/internal/web/actions/default/ui/validateIPs.go index 011f8701..57cd0a48 100644 --- a/internal/web/actions/default/ui/validateIPs.go +++ b/internal/web/actions/default/ui/validateIPs.go @@ -3,9 +3,10 @@ package ui import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "net" "strings" + + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" ) type ValidateIPsAction struct { diff --git a/internal/web/actions/default/users/createPopup.go b/internal/web/actions/default/users/createPopup.go index 889efe8f..9ab13a28 100644 --- a/internal/web/actions/default/users/createPopup.go +++ b/internal/web/actions/default/users/createPopup.go @@ -2,6 +2,7 @@ package users import ( "encoding/json" + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" diff --git a/internal/web/actions/default/users/otpQrcode.go b/internal/web/actions/default/users/otpQrcode.go index 25e41bf0..56ee5f06 100644 --- a/internal/web/actions/default/users/otpQrcode.go +++ b/internal/web/actions/default/users/otpQrcode.go @@ -2,6 +2,7 @@ package users import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" diff --git a/internal/web/actions/default/users/otpQrcode_ext.go b/internal/web/actions/default/users/otpQrcode_ext.go index edc350a5..838b8a84 100644 --- a/internal/web/actions/default/users/otpQrcode_ext.go +++ b/internal/web/actions/default/users/otpQrcode_ext.go @@ -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 . //go:build !plus package users diff --git a/internal/web/actions/default/users/user.go b/internal/web/actions/default/users/user.go index f42daa6d..a2684313 100644 --- a/internal/web/actions/default/users/user.go +++ b/internal/web/actions/default/users/user.go @@ -2,6 +2,7 @@ package users import ( "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils" "github.com/TeaOSLab/EdgeCommon/pkg/iplibrary" diff --git a/internal/web/actions/default/users/userutils/utils.go b/internal/web/actions/default/users/userutils/utils.go index 8dd47c9e..c1c2fd5d 100644 --- a/internal/web/actions/default/users/userutils/utils.go +++ b/internal/web/actions/default/users/userutils/utils.go @@ -3,12 +3,13 @@ package userutils import ( "context" "errors" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/userconfigs" "github.com/iwind/TeaGo/maps" - "strings" ) var ErrUserNotFound = errors.New("not found user") diff --git a/internal/web/helpers/helper_lang.go b/internal/web/helpers/helper_lang.go index 87b43b59..7bd4daeb 100644 --- a/internal/web/helpers/helper_lang.go +++ b/internal/web/helpers/helper_lang.go @@ -1,4 +1,4 @@ -// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud . package helpers diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index a9886466..21d68a8b 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -1,6 +1,11 @@ package helpers import ( + "net/http" + "net/url" + "reflect" + "strings" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/events" @@ -17,10 +22,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" - "net/http" - "net/url" - "reflect" - "strings" ) var nodeLogsCountChanges = make(chan bool, 1) diff --git a/internal/web/helpers/user_should_auth.go b/internal/web/helpers/user_should_auth.go index c13df2ca..754cfb4f 100644 --- a/internal/web/helpers/user_should_auth.go +++ b/internal/web/helpers/user_should_auth.go @@ -1,12 +1,13 @@ package helpers import ( + "net/http" + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/index/loginutils" "github.com/iwind/TeaGo/actions" - "net/http" ) type UserShouldAuth struct { diff --git a/internal/web/helpers/utils.go b/internal/web/helpers/utils.go index 335f5455..574d54b2 100644 --- a/internal/web/helpers/utils.go +++ b/internal/web/helpers/utils.go @@ -3,6 +3,12 @@ package helpers import ( "bytes" "encoding/json" + "net" + "net/http" + "net/url" + "regexp" + "sync" + "github.com/TeaOSLab/EdgeAdmin/internal/events" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" @@ -11,11 +17,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" - "net" - "net/http" - "net/url" - "regexp" - "sync" ) var ipCacheMap = map[string]bool{} // ip => bool diff --git a/internal/web/helpers/utils_gcc.go b/internal/web/helpers/utils_gcc.go index 4c078896..3f916cae 100644 --- a/internal/web/helpers/utils_gcc.go +++ b/internal/web/helpers/utils_gcc.go @@ -1,11 +1,12 @@ -// 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 . //go:build gcc package helpers import ( - "github.com/TeaOSLab/EdgeAdmin/internal/waf/injectionutils" "net/http" + + "github.com/TeaOSLab/EdgeAdmin/internal/waf/injectionutils" ) // filter request diff --git a/internal/web/helpers/utils_none_gcc.go b/internal/web/helpers/utils_none_gcc.go index 2bfcb247..6f83cede 100644 --- a/internal/web/helpers/utils_none_gcc.go +++ b/internal/web/helpers/utils_none_gcc.go @@ -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 . //go:build !gcc package helpers diff --git a/web/public/css/themes/material/assets/fonts/icons.svg b/web/public/css/themes/material/assets/fonts/icons.svg index a449327e..488c729e 100755 --- a/web/public/css/themes/material/assets/fonts/icons.svg +++ b/web/public/css/themes/material/assets/fonts/icons.svg @@ -3,7 +3,7 @@ - + Created by FontForge 20151118 at Mon Feb 8 11:58:02 2016 By shyndman diff --git a/web/public/js/components.js b/web/public/js/components.js index a175938f..a817d436 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -7486,4 +7486,4 @@ example2.com
[选择已有认证]     [添加新认证]
-`}),window.REQUEST_COND_COMPONENTS=[{type:"url-extension",name:"文件扩展名",description:"根据URL中的文件路径扩展名进行过滤",component:"http-cond-url-extension",paramsTitle:"扩展名列表",isRequest:!0,caseInsensitive:!1},{type:"url-eq-index",name:"首页",description:'检查URL路径是为"/"',component:"http-cond-url-eq-index",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!1},{type:"url-all",name:"全站",description:"全站所有URL",component:"http-cond-url-all",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!1},{type:"url-prefix",name:"URL目录前缀",description:"根据URL中的文件路径前缀进行过滤",component:"http-cond-url-prefix",paramsTitle:"URL目录前缀",isRequest:!0,caseInsensitive:!0},{type:"url-eq",name:"URL完整路径",description:"检查URL中的文件路径是否一致",component:"http-cond-url-eq",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!0},{type:"url-regexp",name:"URL正则匹配",description:"使用正则表达式检查URL中的文件路径是否一致",component:"http-cond-url-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"url-wildcard-match",name:"URL通配符",description:"使用通配符检查URL中的文件路径是否一致",component:"http-cond-url-wildcard-match",paramsTitle:"通配符",isRequest:!0,caseInsensitive:!0},{type:"user-agent-regexp",name:"User-Agent正则匹配",description:"使用正则表达式检查User-Agent中是否含有某些浏览器和系统标识",component:"http-cond-user-agent-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"params",name:"参数匹配",description:"根据参数值进行匹配",component:"http-cond-params",paramsTitle:"参数配置",isRequest:!0,caseInsensitive:!1},{type:"url-not-extension",name:"排除:URL扩展名",description:"根据URL中的文件路径扩展名进行过滤",component:"http-cond-url-not-extension",paramsTitle:"扩展名列表",isRequest:!0,caseInsensitive:!1},{type:"url-not-prefix",name:"排除:URL前缀",description:"根据URL中的文件路径前缀进行过滤",component:"http-cond-url-not-prefix",paramsTitle:"URL前缀",isRequest:!0,caseInsensitive:!0},{type:"url-not-eq",name:"排除:URL完整路径",description:"检查URL中的文件路径是否一致",component:"http-cond-url-not-eq",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!0},{type:"url-not-regexp",name:"排除:URL正则匹配",description:"使用正则表达式检查URL中的文件路径是否一致,如果一致,则不匹配",component:"http-cond-url-not-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"user-agent-not-regexp",name:"排除:User-Agent正则匹配",description:"使用正则表达式检查User-Agent中是否含有某些浏览器和系统标识,如果含有,则不匹配",component:"http-cond-user-agent-not-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"mime-type",name:"内容MimeType",description:"根据服务器返回的内容的MimeType进行过滤。注意:当用于缓存条件时,此条件需要结合别的请求条件使用。",component:"http-cond-mime-type",paramsTitle:"MimeType列表",isRequest:!1,caseInsensitive:!1}],window.REQUEST_COND_OPERATORS=[{description:"判断是否正则表达式匹配",name:"正则表达式匹配",op:"regexp"},{description:"判断是否正则表达式不匹配",name:"正则表达式不匹配",op:"not regexp"},{description:"判断是否和指定的通配符匹配",name:"通配符匹配",op:"wildcard match"},{description:"判断是否和指定的通配符不匹配",name:"通配符不匹配",op:"wildcard not match"},{description:"使用字符串对比参数值是否相等于某个值",name:"字符串等于",op:"eq"},{description:"参数值包含某个前缀",name:"字符串前缀",op:"prefix"},{description:"参数值包含某个后缀",name:"字符串后缀",op:"suffix"},{description:"参数值包含另外一个字符串",name:"字符串包含",op:"contains"},{description:"参数值不包含另外一个字符串",name:"字符串不包含",op:"not contains"},{description:"使用字符串对比参数值是否不相等于某个值",name:"字符串不等于",op:"not"},{description:"判断参数值在某个列表中",name:"在列表中",op:"in"},{description:"判断参数值不在某个列表中",name:"不在列表中",op:"not in"},{description:"判断小写的扩展名(不带点)在某个列表中",name:"扩展名",op:"file ext"},{description:"判断MimeType在某个列表中,支持类似于image/*的语法",name:"MimeType",op:"mime type"},{description:"判断版本号在某个范围内,格式为version1,version2",name:"版本号范围",op:"version range"},{description:"将参数转换为整数数字后进行对比",name:"整数等于",op:"eq int"},{description:"将参数转换为可以有小数的浮点数字进行对比",name:"浮点数等于",op:"eq float"},{description:"将参数转换为数字进行对比",name:"数字大于",op:"gt"},{description:"将参数转换为数字进行对比",name:"数字大于等于",op:"gte"},{description:"将参数转换为数字进行对比",name:"数字小于",op:"lt"},{description:"将参数转换为数字进行对比",name:"数字小于等于",op:"lte"},{description:"对整数参数值取模,除数为10,对比值为余数",name:"整数取模10",op:"mod 10"},{description:"对整数参数值取模,除数为100,对比值为余数",name:"整数取模100",op:"mod 100"},{description:"对整数参数值取模,对比值格式为:除数,余数,比如10,1",name:"整数取模",op:"mod"},{description:"将参数转换为IP进行对比",name:"IP等于",op:"eq ip"},{description:"将参数转换为IP进行对比",name:"IP大于",op:"gt ip"},{description:"将参数转换为IP进行对比",name:"IP大于等于",op:"gte ip"},{description:"将参数转换为IP进行对比",name:"IP小于",op:"lt ip"},{description:"将参数转换为IP进行对比",name:"IP小于等于",op:"lte ip"},{description:"IP在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200,或者CIDR格式的ip/bits,比如192.168.2.1/24",name:"IP范围",op:"ip range"},{description:"对IP参数值取模,除数为10,对比值为余数",name:"IP取模10",op:"ip mod 10"},{description:"对IP参数值取模,除数为100,对比值为余数",name:"IP取模100",op:"ip mod 100"},{description:"对IP参数值取模,对比值格式为:除数,余数,比如10,1",name:"IP取模",op:"ip mod"}],window.REQUEST_VARIABLES=[{code:"${edgeVersion}",description:"",name:"边缘节点版本"},{code:"${remoteAddr}",description:"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适合前端有别的反向代理服务时使用,存在伪造的风险",name:"客户端地址(IP)"},{code:"${rawRemoteAddr}",description:"返回直接连接服务的客户端原始IP地址",name:"客户端地址(IP)"},{code:"${remotePort}",description:"",name:"客户端端口"},{code:"${remoteUser}",description:"",name:"客户端用户名"},{code:"${requestURI}",description:"比如/hello?name=lily",name:"请求URI"},{code:"${requestPath}",description:"比如/hello",name:"请求路径(不包括参数)"},{code:"${requestURL}",description:"比如https://example.com/hello?name=lily",name:"完整的请求URL"},{code:"${requestLength}",description:"",name:"请求内容长度"},{code:"${requestMethod}",description:"比如GET、POST",name:"请求方法"},{code:"${requestFilename}",description:"",name:"请求文件路径"},{code:"${requestPathExtension}",description:"请求路径中的文件扩展名,包括点符号,比如.html、.png",name:"请求文件扩展名"},{code:"${requestPathLowerExtension}",description:"请求路径中的文件扩展名,其中大写字母会被自动转换为小写,包括点符号,比如.html、.png",name:"请求文件小写扩展名"},{code:"${scheme}",description:"",name:"请求协议,http或https"},{code:"${proto}","description:":"类似于HTTP/1.0",name:"包含版本的HTTP请求协议"},{code:"${timeISO8601}",description:"比如2018-07-16T23:52:24.839+08:00",name:"ISO 8601格式的时间"},{code:"${timeLocal}",description:"比如17/Jul/2018:09:52:24 +0800",name:"本地时间"},{code:"${msec}",description:"比如1531756823.054",name:"带有毫秒的时间"},{code:"${timestamp}",description:"",name:"unix时间戳,单位为秒"},{code:"${host}",description:"",name:"主机名"},{code:"${cname}",description:"比如38b48e4f.goedge.cn",name:"当前网站的CNAME"},{code:"${serverName}",description:"",name:"接收请求的服务器名"},{code:"${serverPort}",description:"",name:"接收请求的服务器端口"},{code:"${referer}",description:"",name:"请求来源URL"},{code:"${referer.host}",description:"",name:"请求来源URL域名"},{code:"${userAgent}",description:"",name:"客户端信息"},{code:"${contentType}",description:"",name:"请求头部的Content-Type"},{code:"${cookies}",description:"",name:"所有cookie组合字符串"},{code:"${cookie.NAME}",description:"",name:"单个cookie值"},{code:"${isArgs}",description:"如果URL有参数,则值为`?`;否则,则值为空",name:"问号(?)标记"},{code:"${args}",description:"",name:"所有参数组合字符串"},{code:"${arg.NAME}",description:"",name:"单个参数值"},{code:"${headers}",description:"",name:"所有Header信息组合字符串"},{code:"${header.NAME}",description:"",name:"单个Header值"},{code:"${geo.country.name}",description:"",name:"国家/地区名称"},{code:"${geo.country.id}",description:"",name:"国家/地区ID"},{code:"${geo.province.name}",description:"目前只包含中国省份",name:"省份名称"},{code:"${geo.province.id}",description:"目前只包含中国省份",name:"省份ID"},{code:"${geo.city.name}",description:"目前只包含中国城市",name:"城市名称"},{code:"${geo.city.id}",description:"目前只包含中国城市",name:"城市名称"},{code:"${isp.name}",description:"",name:"ISP服务商名称"},{code:"${isp.id}",description:"",name:"ISP服务商ID"},{code:"${browser.os.name}",description:"客户端所在操作系统名称",name:"操作系统名称"},{code:"${browser.os.version}",description:"客户端所在操作系统版本",name:"操作系统版本"},{code:"${browser.name}",description:"客户端浏览器名称",name:"浏览器名称"},{code:"${browser.version}",description:"客户端浏览器版本",name:"浏览器版本"},{code:"${browser.isMobile}",description:"如果客户端是手机,则值为1,否则为0",name:"手机标识"}],window.METRIC_HTTP_KEYS=[{name:"客户端地址(IP)",code:"${remoteAddr}",description:"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适用于前端可能有别的反向代理的情形,存在被伪造的可能",icon:""},{name:"直接客户端地址(IP)",code:"${rawRemoteAddr}",description:"返回直接连接服务的客户端原始IP地址",icon:""},{name:"客户端用户名",code:"${remoteUser}",description:"通过基本认证填入的用户名",icon:""},{name:"请求URI",code:"${requestURI}",description:"包含参数,比如/hello?name=lily",icon:""},{name:"请求路径",code:"${requestPath}",description:"不包含参数,比如/hello",icon:""},{name:"完整URL",code:"${requestURL}",description:"比如https://example.com/hello?name=lily",icon:""},{name:"请求方法",code:"${requestMethod}",description:"比如GET、POST等",icon:""},{name:"请求协议Scheme",code:"${scheme}",description:"http或https",icon:""},{name:"文件扩展名",code:"${requestPathExtension}",description:"请求路径中的文件扩展名,包括点符号,比如.html、.png",icon:""},{name:"小写文件扩展名",code:"${requestPathLowerExtension}",description:"请求路径中的文件扩展名小写形式,包括点符号,比如.html、.png",icon:""},{name:"主机名",code:"${host}",description:"通常是请求的域名",icon:""},{name:"HTTP协议",code:"${proto}",description:"包含版本的HTTP请求协议,类似于HTTP/1.0",icon:""},{name:"URL参数值",code:"${arg.NAME}",description:"单个URL参数值",icon:""},{name:"请求来源URL",code:"${referer}",description:"请求来源Referer URL",icon:""},{name:"请求来源URL域名",code:"${referer.host}",description:"请求来源Referer URL域名",icon:""},{name:"Header值",code:"${header.NAME}",description:"单个Header值,比如${header.User-Agent}",icon:""},{name:"Cookie值",code:"${cookie.NAME}",description:"单个cookie值,比如${cookie.sid}",icon:""},{name:"状态码",code:"${status}",description:"",icon:""},{name:"响应的Content-Type值",code:"${response.contentType}",description:"",icon:""}],window.IP_ADDR_THRESHOLD_ITEMS=[{code:"nodeAvgRequests",description:"当前节点在单位时间内接收到的平均请求数。",name:"节点平均请求数",unit:"个"},{code:"nodeAvgTrafficOut",description:"当前节点在单位时间内发送的下行流量。",name:"节点平均下行流量",unit:"M"},{code:"nodeAvgTrafficIn",description:"当前节点在单位时间内接收的上行流量。",name:"节点平均上行流量",unit:"M"},{code:"nodeHealthCheck",description:"当前节点健康检查结果。",name:"节点健康检查结果",unit:""},{code:"connectivity",description:"通过区域监控得到的当前IP地址的连通性数值,取值在0和100之间。",name:"IP连通性",unit:"%"},{code:"groupAvgRequests",description:"当前节点所在分组在单位时间内接收到的平均请求数。",name:"分组平均请求数",unit:"个"},{code:"groupAvgTrafficOut",description:"当前节点所在分组在单位时间内发送的下行流量。",name:"分组平均下行流量",unit:"M"},{code:"groupAvgTrafficIn",description:"当前节点所在分组在单位时间内接收的上行流量。",name:"分组平均上行流量",unit:"M"},{code:"clusterAvgRequests",description:"当前节点所在集群在单位时间内接收到的平均请求数。",name:"集群平均请求数",unit:"个"},{code:"clusterAvgTrafficOut",description:"当前节点所在集群在单位时间内发送的下行流量。",name:"集群平均下行流量",unit:"M"},{code:"clusterAvgTrafficIn",description:"当前节点所在集群在单位时间内接收的上行流量。",name:"集群平均上行流量",unit:"M"}],window.IP_ADDR_THRESHOLD_ACTIONS=[{code:"up",description:"上线当前IP。",name:"上线"},{code:"down",description:"下线当前IP。",name:"下线"},{code:"notify",description:"发送已达到阈值通知。",name:"通知"},{code:"switch",description:"在DNS中记录中将IP切换到指定的备用IP。",name:"切换"},{code:"webHook",description:"调用外部的WebHook。",name:"WebHook"}],window.WAF_RULE_CHECKPOINTS=[{description:"通用报头比如Cache-Control、Accept之类的长度限制,防止缓冲区溢出攻击。",name:"通用请求报头长度限制",prefix:"requestGeneralHeaderLength"},{description:"通用报头比如Cache-Control、Date之类的长度限制,防止缓冲区溢出攻击。",name:"通用响应报头长度限制",prefix:"responseGeneralHeaderLength"},{description:"试图通过分析X-Forwarded-For等报头获取的客户端地址,比如192.168.1.100,存在伪造的可能。",name:"客户端地址(IP)",prefix:"remoteAddr"},{description:"直接连接的客户端地址,比如192.168.1.100。",name:"客户端源地址(IP)",prefix:"rawRemoteAddr"},{description:"直接连接的客户端地址端口。",name:"客户端端口",prefix:"remotePort"},{description:"通过BasicAuth登录的客户端用户名。",name:"客户端用户名",prefix:"remoteUser"},{description:"包含URL参数的请求URI,类似于 /hello/world?lang=go,不包含域名部分。",name:"请求URI",prefix:"requestURI"},{description:"不包含URL参数的请求路径,类似于 /hello/world,不包含域名部分。",name:"请求路径",prefix:"requestPath"},{description:"完整的请求URL,包含协议、域名、请求路径、参数等,类似于 https://example.com/hello?name=lily 。",name:"请求完整URL",prefix:"requestURL"},{description:"请求报头中的Content-Length。",name:"请求内容长度",prefix:"requestLength"},{description:"通常在POST或者PUT等操作时会附带请求体,最大限制32M。",name:"请求体内容",prefix:"requestBody"},{description:"${requestURI}和${requestBody}组合。",name:"请求URI和请求体组合",prefix:"requestAll"},{description:"获取POST或者其他方法发送的表单参数,最大请求体限制32M。",name:"请求表单参数",prefix:"requestForm"},{description:"获取POST上传的文件信息,最大请求体限制32M。",name:"上传文件",prefix:"requestUpload"},{description:"获取POST或者其他方法发送的JSON,最大请求体限制32M,使用点(.)符号表示多级数据。",name:"请求JSON参数",prefix:"requestJSON"},{description:"比如GET、POST。",name:"请求方法",prefix:"requestMethod"},{description:"比如http或https。",name:"请求协议",prefix:"scheme"},{description:"比如HTTP/1.1。",name:"HTTP协议版本",prefix:"proto"},{description:"比如example.com。",name:"主机名",prefix:"host"},{description:"当前网站服务CNAME,比如38b48e4f.example.com。",name:"CNAME",prefix:"cname"},{description:"是否为CNAME,值为1(是)或0(否)。",name:"是否为CNAME",prefix:"isCNAME"},{description:"请求报头中的Referer和Origin值。",name:"请求来源",prefix:"refererOrigin"},{description:"请求报头中的Referer值。",name:"请求来源Referer",prefix:"referer"},{description:"比如Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103。",name:"客户端信息",prefix:"userAgent"},{description:"请求报头的Content-Type。",name:"内容类型",prefix:"contentType"},{description:"比如sid=IxZVPFhE&city=beijing&uid=18237。",name:"所有cookie组合字符串",prefix:"cookies"},{description:"单个cookie值。",name:"单个cookie值",prefix:"cookie"},{description:"比如name=lu&age=20。",name:"所有URL参数组合",prefix:"args"},{description:"单个URL参数值。",name:"单个URL参数值",prefix:"arg"},{description:'使用换行符(\\n)隔开的报头内容字符串,每行均为"NAME: VALUE格式"。',name:"所有请求报头内容",prefix:"headers"},{description:"使用换行符(\\n)隔开的报头名称字符串,每行一个名称。",name:"所有请求报头名称",prefix:"headerNames"},{description:"单个报头值。",name:"单个请求报头值",prefix:"header"},{description:"最长的请求报头的长度。",name:"请求报头最大长度",prefix:"headerMaxLength"},{description:"当前客户端所处国家/地区名称。",name:"国家/地区名称",prefix:"geoCountryName"},{description:"当前客户端所处中国省份名称。",name:"省份名称",prefix:"geoProvinceName"},{description:"当前客户端所处中国城市名称。",name:"城市名称",prefix:"geoCityName"},{description:"当前客户端所处ISP名称。",name:"ISP名称",prefix:"ispName"},{description:"对统计对象进行统计。",name:"CC统计",prefix:"cc2"},{description:"对统计对象进行统计。",name:"防盗链",prefix:"refererBlock"},{description:"统计某段时间段内的请求信息(不推荐再使用,请使用新的CC2统计代替)。",name:"CC统计(旧)",prefix:"cc"},{description:"响应状态码,比如200、404、500。",name:"响应状态码",prefix:"status"},{description:"响应报头值。",name:"响应报头",prefix:"responseHeader"},{description:"响应内容字符串。",name:"响应内容",prefix:"responseBody"},{description:"响应内容长度,通过响应的报头Content-Length获取。",name:"响应内容长度",prefix:"bytesSent"}],window.WAF_RULE_OPERATORS=[{name:"正则匹配",code:"match",description:'使用正则表达式匹配,在头部使用(?i)表示不区分大小写,正则表达式语法 »。',caseInsensitive:"yes",dataType:"regexp"},{name:"正则不匹配",code:"not match",description:'使用正则表达式不匹配,在头部使用(?i)表示不区分大小写,正则表达式语法 »。',caseInsensitive:"yes",dataType:"regexp"},{name:"通配符匹配",code:"wildcard match",description:"判断是否和指定的通配符匹配,可以在对比值中使用星号通配符(*)表示任意字符。",caseInsensitive:"yes",dataType:"wildcard"},{name:"通配符不匹配",code:"wildcard not match",description:"判断是否和指定的通配符不匹配,可以在对比值中使用星号通配符(*)表示任意字符。",caseInsensitive:"yes",dataType:"wildcard"},{name:"字符串等于",code:"eq string",description:"使用字符串对比等于。",caseInsensitive:"no",dataType:"string"},{name:"字符串不等于",code:"neq string",description:"使用字符串对比不等于。",caseInsensitive:"no",dataType:"string"},{name:"包含字符串",code:"contains",description:"包含某个字符串,比如Hello World包含了World。",caseInsensitive:"no",dataType:"string"},{name:"不包含字符串",code:"not contains",description:"不包含某个字符串,比如Hello字符串中不包含Hi。",caseInsensitive:"no",dataType:"string"},{name:"包含任一字符串",code:"contains any",description:"包含字符串列表中的任意一个,比如/hello/world包含/hello和/hi中的/hello,对比值中每行一个字符串。",caseInsensitive:"no",dataType:"strings"},{name:"包含所有字符串",code:"contains all",description:"包含字符串列表中的所有字符串,比如/hello/world必须包含/hello和/world,对比值中每行一个字符串。",caseInsensitive:"no",dataType:"strings"},{name:"包含前缀",code:"prefix",description:"包含字符串前缀部分,比如/hello前缀会匹配/hello, /hello/world等。",caseInsensitive:"no",dataType:"string"},{name:"包含后缀",code:"suffix",description:"包含字符串后缀部分,比如/hello后缀会匹配/hello, /hi/hello等。",caseInsensitive:"no",dataType:"string"},{name:"包含任一单词",code:"contains any word",description:"包含某个独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"包含所有单词",code:"contains all words",description:"包含所有的独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"不包含任一单词",code:"not contains any word",description:"不包含某个独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"包含SQL注入",code:"contains sql injection",description:"检测字符串内容是否包含SQL注入。",caseInsensitive:"none",dataType:"none"},{name:"包含SQL注入-严格模式",code:"contains sql injection strictly",description:"更加严格地检测字符串内容是否包含SQL注入,相对于非严格模式,有一定的误报几率。",caseInsensitive:"none",dataType:"none"},{name:"包含XSS注入",code:"contains xss",description:"检测字符串内容是否包含XSS注入。",caseInsensitive:"none",dataType:"none"},{name:"包含XSS注入-严格模式",code:"contains xss strictly",description:"更加严格地检测字符串内容是否包含XSS注入,相对于非严格模式,此时xml、audio、video等标签也会被匹配。",caseInsensitive:"none",dataType:"none"},{name:"包含二进制数据",code:"contains binary",description:"包含一组二进制数据。",caseInsensitive:"no",dataType:"string"},{name:"不包含二进制数据",code:"not contains binary",description:"不包含一组二进制数据。",caseInsensitive:"no",dataType:"string"},{name:"数值大于",code:"gt",description:"使用数值对比大于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值大于等于",code:"gte",description:"使用数值对比大于等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值小于",code:"lt",description:"使用数值对比小于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值小于等于",code:"lte",description:"使用数值对比小于等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值等于",code:"eq",description:"使用数值对比等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值不等于",code:"neq",description:"使用数值对比不等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"包含索引",code:"has key",description:"对于一组数据拥有某个键值或者索引。",caseInsensitive:"no",dataType:"string|number"},{name:"版本号大于",code:"version gt",description:"对比版本号大于。",caseInsensitive:"none",dataType:"version"},{name:"版本号小于",code:"version lt",description:"对比版本号小于。",caseInsensitive:"none",dataType:"version"},{name:"版本号范围",code:"version range",description:"判断版本号在某个范围内,格式为 起始version1,结束version2。",caseInsensitive:"none",dataType:"versionRange"},{name:"IP等于",code:"eq ip",description:"将参数转换为IP进行对比,只能对比单个IP。",caseInsensitive:"none",dataType:"ip"},{name:"在一组IP中",code:"in ip list",description:"判断参数IP在一组IP内,对比值中每行一个IP。",caseInsensitive:"none",dataType:"ips"},{name:"IP大于",code:"gt ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP大于等于",code:"gte ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP小于",code:"lt ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP小于等于",code:"lte ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP范围",code:"ip range",description:"IP在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200;或者CIDR格式的ip/bits,比如192.168.2.1/24;或者单个IP。可以填写多行,每行一个IP范围。",caseInsensitive:"none",dataType:"ips"},{name:"不在IP范围",code:"not ip range",description:"IP不在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200;或者CIDR格式的ip/bits,比如192.168.2.1/24;或者单个IP。可以填写多行,每行一个IP范围。",caseInsensitive:"none",dataType:"ips"},{name:"IP取模10",code:"ip mod 10",description:"对IP参数值取模,除数为10,对比值为余数。",caseInsensitive:"none",dataType:"number"},{name:"IP取模100",code:"ip mod 100",description:"对IP参数值取模,除数为100,对比值为余数。",caseInsensitive:"none",dataType:"number"},{name:"IP取模",code:"ip mod",description:"对IP参数值取模,对比值格式为:除数,余数,比如10,1。",caseInsensitive:"none",dataType:"number"}],window.WAF_CAPTCHA_TYPES=[{name:"验证码",code:"default",description:"通过输入验证码来验证人机。",icon:""},{name:"点击验证",code:"oneClick",description:"通过点击界面元素来验证人机。",icon:""},{name:"滑动解锁",code:"slide",description:"通过滑动方块解锁来验证人机。",icon:""},{name:"极验-行为验",code:"geetest",description:"使用极验-行为验提供的人机验证方式。",icon:""}]; +`}),window.REQUEST_COND_COMPONENTS=[{type:"url-extension",name:"文件扩展名",description:"根据URL中的文件路径扩展名进行过滤",component:"http-cond-url-extension",paramsTitle:"扩展名列表",isRequest:!0,caseInsensitive:!1},{type:"url-eq-index",name:"首页",description:'检查URL路径是为"/"',component:"http-cond-url-eq-index",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!1},{type:"url-all",name:"全站",description:"全站所有URL",component:"http-cond-url-all",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!1},{type:"url-prefix",name:"URL目录前缀",description:"根据URL中的文件路径前缀进行过滤",component:"http-cond-url-prefix",paramsTitle:"URL目录前缀",isRequest:!0,caseInsensitive:!0},{type:"url-eq",name:"URL完整路径",description:"检查URL中的文件路径是否一致",component:"http-cond-url-eq",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!0},{type:"url-regexp",name:"URL正则匹配",description:"使用正则表达式检查URL中的文件路径是否一致",component:"http-cond-url-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"url-wildcard-match",name:"URL通配符",description:"使用通配符检查URL中的文件路径是否一致",component:"http-cond-url-wildcard-match",paramsTitle:"通配符",isRequest:!0,caseInsensitive:!0},{type:"user-agent-regexp",name:"User-Agent正则匹配",description:"使用正则表达式检查User-Agent中是否含有某些浏览器和系统标识",component:"http-cond-user-agent-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"params",name:"参数匹配",description:"根据参数值进行匹配",component:"http-cond-params",paramsTitle:"参数配置",isRequest:!0,caseInsensitive:!1},{type:"url-not-extension",name:"排除:URL扩展名",description:"根据URL中的文件路径扩展名进行过滤",component:"http-cond-url-not-extension",paramsTitle:"扩展名列表",isRequest:!0,caseInsensitive:!1},{type:"url-not-prefix",name:"排除:URL前缀",description:"根据URL中的文件路径前缀进行过滤",component:"http-cond-url-not-prefix",paramsTitle:"URL前缀",isRequest:!0,caseInsensitive:!0},{type:"url-not-eq",name:"排除:URL完整路径",description:"检查URL中的文件路径是否一致",component:"http-cond-url-not-eq",paramsTitle:"URL完整路径",isRequest:!0,caseInsensitive:!0},{type:"url-not-regexp",name:"排除:URL正则匹配",description:"使用正则表达式检查URL中的文件路径是否一致,如果一致,则不匹配",component:"http-cond-url-not-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"user-agent-not-regexp",name:"排除:User-Agent正则匹配",description:"使用正则表达式检查User-Agent中是否含有某些浏览器和系统标识,如果含有,则不匹配",component:"http-cond-user-agent-not-regexp",paramsTitle:"正则表达式",isRequest:!0,caseInsensitive:!0},{type:"mime-type",name:"内容MimeType",description:"根据服务器返回的内容的MimeType进行过滤。注意:当用于缓存条件时,此条件需要结合别的请求条件使用。",component:"http-cond-mime-type",paramsTitle:"MimeType列表",isRequest:!1,caseInsensitive:!1}],window.REQUEST_COND_OPERATORS=[{description:"判断是否正则表达式匹配",name:"正则表达式匹配",op:"regexp"},{description:"判断是否正则表达式不匹配",name:"正则表达式不匹配",op:"not regexp"},{description:"判断是否和指定的通配符匹配",name:"通配符匹配",op:"wildcard match"},{description:"判断是否和指定的通配符不匹配",name:"通配符不匹配",op:"wildcard not match"},{description:"使用字符串对比参数值是否相等于某个值",name:"字符串等于",op:"eq"},{description:"参数值包含某个前缀",name:"字符串前缀",op:"prefix"},{description:"参数值包含某个后缀",name:"字符串后缀",op:"suffix"},{description:"参数值包含另外一个字符串",name:"字符串包含",op:"contains"},{description:"参数值不包含另外一个字符串",name:"字符串不包含",op:"not contains"},{description:"使用字符串对比参数值是否不相等于某个值",name:"字符串不等于",op:"not"},{description:"判断参数值在某个列表中",name:"在列表中",op:"in"},{description:"判断参数值不在某个列表中",name:"不在列表中",op:"not in"},{description:"判断小写的扩展名(不带点)在某个列表中",name:"扩展名",op:"file ext"},{description:"判断MimeType在某个列表中,支持类似于image/*的语法",name:"MimeType",op:"mime type"},{description:"判断版本号在某个范围内,格式为version1,version2",name:"版本号范围",op:"version range"},{description:"将参数转换为整数数字后进行对比",name:"整数等于",op:"eq int"},{description:"将参数转换为可以有小数的浮点数字进行对比",name:"浮点数等于",op:"eq float"},{description:"将参数转换为数字进行对比",name:"数字大于",op:"gt"},{description:"将参数转换为数字进行对比",name:"数字大于等于",op:"gte"},{description:"将参数转换为数字进行对比",name:"数字小于",op:"lt"},{description:"将参数转换为数字进行对比",name:"数字小于等于",op:"lte"},{description:"对整数参数值取模,除数为10,对比值为余数",name:"整数取模10",op:"mod 10"},{description:"对整数参数值取模,除数为100,对比值为余数",name:"整数取模100",op:"mod 100"},{description:"对整数参数值取模,对比值格式为:除数,余数,比如10,1",name:"整数取模",op:"mod"},{description:"将参数转换为IP进行对比",name:"IP等于",op:"eq ip"},{description:"将参数转换为IP进行对比",name:"IP大于",op:"gt ip"},{description:"将参数转换为IP进行对比",name:"IP大于等于",op:"gte ip"},{description:"将参数转换为IP进行对比",name:"IP小于",op:"lt ip"},{description:"将参数转换为IP进行对比",name:"IP小于等于",op:"lte ip"},{description:"IP在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200,或者CIDR格式的ip/bits,比如192.168.2.1/24",name:"IP范围",op:"ip range"},{description:"对IP参数值取模,除数为10,对比值为余数",name:"IP取模10",op:"ip mod 10"},{description:"对IP参数值取模,除数为100,对比值为余数",name:"IP取模100",op:"ip mod 100"},{description:"对IP参数值取模,对比值格式为:除数,余数,比如10,1",name:"IP取模",op:"ip mod"}],window.REQUEST_VARIABLES=[{code:"${edgeVersion}",description:"",name:"边缘节点版本"},{code:"${remoteAddr}",description:"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适合前端有别的反向代理服务时使用,存在伪造的风险",name:"客户端地址(IP)"},{code:"${rawRemoteAddr}",description:"返回直接连接服务的客户端原始IP地址",name:"客户端地址(IP)"},{code:"${remotePort}",description:"",name:"客户端端口"},{code:"${remoteUser}",description:"",name:"客户端用户名"},{code:"${requestURI}",description:"比如/hello?name=lily",name:"请求URI"},{code:"${requestPath}",description:"比如/hello",name:"请求路径(不包括参数)"},{code:"${requestURL}",description:"比如https://example.com/hello?name=lily",name:"完整的请求URL"},{code:"${requestLength}",description:"",name:"请求内容长度"},{code:"${requestMethod}",description:"比如GET、POST",name:"请求方法"},{code:"${requestFilename}",description:"",name:"请求文件路径"},{code:"${requestPathExtension}",description:"请求路径中的文件扩展名,包括点符号,比如.html、.png",name:"请求文件扩展名"},{code:"${requestPathLowerExtension}",description:"请求路径中的文件扩展名,其中大写字母会被自动转换为小写,包括点符号,比如.html、.png",name:"请求文件小写扩展名"},{code:"${scheme}",description:"",name:"请求协议,http或https"},{code:"${proto}","description:":"类似于HTTP/1.0",name:"包含版本的HTTP请求协议"},{code:"${timeISO8601}",description:"比如2018-07-16T23:52:24.839+08:00",name:"ISO 8601格式的时间"},{code:"${timeLocal}",description:"比如17/Jul/2018:09:52:24 +0800",name:"本地时间"},{code:"${msec}",description:"比如1531756823.054",name:"带有毫秒的时间"},{code:"${timestamp}",description:"",name:"unix时间戳,单位为秒"},{code:"${host}",description:"",name:"主机名"},{code:"${cname}",description:"比如38b48e4f.goedge.cloud",name:"当前网站的CNAME"},{code:"${serverName}",description:"",name:"接收请求的服务器名"},{code:"${serverPort}",description:"",name:"接收请求的服务器端口"},{code:"${referer}",description:"",name:"请求来源URL"},{code:"${referer.host}",description:"",name:"请求来源URL域名"},{code:"${userAgent}",description:"",name:"客户端信息"},{code:"${contentType}",description:"",name:"请求头部的Content-Type"},{code:"${cookies}",description:"",name:"所有cookie组合字符串"},{code:"${cookie.NAME}",description:"",name:"单个cookie值"},{code:"${isArgs}",description:"如果URL有参数,则值为`?`;否则,则值为空",name:"问号(?)标记"},{code:"${args}",description:"",name:"所有参数组合字符串"},{code:"${arg.NAME}",description:"",name:"单个参数值"},{code:"${headers}",description:"",name:"所有Header信息组合字符串"},{code:"${header.NAME}",description:"",name:"单个Header值"},{code:"${geo.country.name}",description:"",name:"国家/地区名称"},{code:"${geo.country.id}",description:"",name:"国家/地区ID"},{code:"${geo.province.name}",description:"目前只包含中国省份",name:"省份名称"},{code:"${geo.province.id}",description:"目前只包含中国省份",name:"省份ID"},{code:"${geo.city.name}",description:"目前只包含中国城市",name:"城市名称"},{code:"${geo.city.id}",description:"目前只包含中国城市",name:"城市名称"},{code:"${isp.name}",description:"",name:"ISP服务商名称"},{code:"${isp.id}",description:"",name:"ISP服务商ID"},{code:"${browser.os.name}",description:"客户端所在操作系统名称",name:"操作系统名称"},{code:"${browser.os.version}",description:"客户端所在操作系统版本",name:"操作系统版本"},{code:"${browser.name}",description:"客户端浏览器名称",name:"浏览器名称"},{code:"${browser.version}",description:"客户端浏览器版本",name:"浏览器版本"},{code:"${browser.isMobile}",description:"如果客户端是手机,则值为1,否则为0",name:"手机标识"}],window.METRIC_HTTP_KEYS=[{name:"客户端地址(IP)",code:"${remoteAddr}",description:"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适用于前端可能有别的反向代理的情形,存在被伪造的可能",icon:""},{name:"直接客户端地址(IP)",code:"${rawRemoteAddr}",description:"返回直接连接服务的客户端原始IP地址",icon:""},{name:"客户端用户名",code:"${remoteUser}",description:"通过基本认证填入的用户名",icon:""},{name:"请求URI",code:"${requestURI}",description:"包含参数,比如/hello?name=lily",icon:""},{name:"请求路径",code:"${requestPath}",description:"不包含参数,比如/hello",icon:""},{name:"完整URL",code:"${requestURL}",description:"比如https://example.com/hello?name=lily",icon:""},{name:"请求方法",code:"${requestMethod}",description:"比如GET、POST等",icon:""},{name:"请求协议Scheme",code:"${scheme}",description:"http或https",icon:""},{name:"文件扩展名",code:"${requestPathExtension}",description:"请求路径中的文件扩展名,包括点符号,比如.html、.png",icon:""},{name:"小写文件扩展名",code:"${requestPathLowerExtension}",description:"请求路径中的文件扩展名小写形式,包括点符号,比如.html、.png",icon:""},{name:"主机名",code:"${host}",description:"通常是请求的域名",icon:""},{name:"HTTP协议",code:"${proto}",description:"包含版本的HTTP请求协议,类似于HTTP/1.0",icon:""},{name:"URL参数值",code:"${arg.NAME}",description:"单个URL参数值",icon:""},{name:"请求来源URL",code:"${referer}",description:"请求来源Referer URL",icon:""},{name:"请求来源URL域名",code:"${referer.host}",description:"请求来源Referer URL域名",icon:""},{name:"Header值",code:"${header.NAME}",description:"单个Header值,比如${header.User-Agent}",icon:""},{name:"Cookie值",code:"${cookie.NAME}",description:"单个cookie值,比如${cookie.sid}",icon:""},{name:"状态码",code:"${status}",description:"",icon:""},{name:"响应的Content-Type值",code:"${response.contentType}",description:"",icon:""}],window.IP_ADDR_THRESHOLD_ITEMS=[{code:"nodeAvgRequests",description:"当前节点在单位时间内接收到的平均请求数。",name:"节点平均请求数",unit:"个"},{code:"nodeAvgTrafficOut",description:"当前节点在单位时间内发送的下行流量。",name:"节点平均下行流量",unit:"M"},{code:"nodeAvgTrafficIn",description:"当前节点在单位时间内接收的上行流量。",name:"节点平均上行流量",unit:"M"},{code:"nodeHealthCheck",description:"当前节点健康检查结果。",name:"节点健康检查结果",unit:""},{code:"connectivity",description:"通过区域监控得到的当前IP地址的连通性数值,取值在0和100之间。",name:"IP连通性",unit:"%"},{code:"groupAvgRequests",description:"当前节点所在分组在单位时间内接收到的平均请求数。",name:"分组平均请求数",unit:"个"},{code:"groupAvgTrafficOut",description:"当前节点所在分组在单位时间内发送的下行流量。",name:"分组平均下行流量",unit:"M"},{code:"groupAvgTrafficIn",description:"当前节点所在分组在单位时间内接收的上行流量。",name:"分组平均上行流量",unit:"M"},{code:"clusterAvgRequests",description:"当前节点所在集群在单位时间内接收到的平均请求数。",name:"集群平均请求数",unit:"个"},{code:"clusterAvgTrafficOut",description:"当前节点所在集群在单位时间内发送的下行流量。",name:"集群平均下行流量",unit:"M"},{code:"clusterAvgTrafficIn",description:"当前节点所在集群在单位时间内接收的上行流量。",name:"集群平均上行流量",unit:"M"}],window.IP_ADDR_THRESHOLD_ACTIONS=[{code:"up",description:"上线当前IP。",name:"上线"},{code:"down",description:"下线当前IP。",name:"下线"},{code:"notify",description:"发送已达到阈值通知。",name:"通知"},{code:"switch",description:"在DNS中记录中将IP切换到指定的备用IP。",name:"切换"},{code:"webHook",description:"调用外部的WebHook。",name:"WebHook"}],window.WAF_RULE_CHECKPOINTS=[{description:"通用报头比如Cache-Control、Accept之类的长度限制,防止缓冲区溢出攻击。",name:"通用请求报头长度限制",prefix:"requestGeneralHeaderLength"},{description:"通用报头比如Cache-Control、Date之类的长度限制,防止缓冲区溢出攻击。",name:"通用响应报头长度限制",prefix:"responseGeneralHeaderLength"},{description:"试图通过分析X-Forwarded-For等报头获取的客户端地址,比如192.168.1.100,存在伪造的可能。",name:"客户端地址(IP)",prefix:"remoteAddr"},{description:"直接连接的客户端地址,比如192.168.1.100。",name:"客户端源地址(IP)",prefix:"rawRemoteAddr"},{description:"直接连接的客户端地址端口。",name:"客户端端口",prefix:"remotePort"},{description:"通过BasicAuth登录的客户端用户名。",name:"客户端用户名",prefix:"remoteUser"},{description:"包含URL参数的请求URI,类似于 /hello/world?lang=go,不包含域名部分。",name:"请求URI",prefix:"requestURI"},{description:"不包含URL参数的请求路径,类似于 /hello/world,不包含域名部分。",name:"请求路径",prefix:"requestPath"},{description:"完整的请求URL,包含协议、域名、请求路径、参数等,类似于 https://example.com/hello?name=lily 。",name:"请求完整URL",prefix:"requestURL"},{description:"请求报头中的Content-Length。",name:"请求内容长度",prefix:"requestLength"},{description:"通常在POST或者PUT等操作时会附带请求体,最大限制32M。",name:"请求体内容",prefix:"requestBody"},{description:"${requestURI}和${requestBody}组合。",name:"请求URI和请求体组合",prefix:"requestAll"},{description:"获取POST或者其他方法发送的表单参数,最大请求体限制32M。",name:"请求表单参数",prefix:"requestForm"},{description:"获取POST上传的文件信息,最大请求体限制32M。",name:"上传文件",prefix:"requestUpload"},{description:"获取POST或者其他方法发送的JSON,最大请求体限制32M,使用点(.)符号表示多级数据。",name:"请求JSON参数",prefix:"requestJSON"},{description:"比如GET、POST。",name:"请求方法",prefix:"requestMethod"},{description:"比如http或https。",name:"请求协议",prefix:"scheme"},{description:"比如HTTP/1.1。",name:"HTTP协议版本",prefix:"proto"},{description:"比如example.com。",name:"主机名",prefix:"host"},{description:"当前网站服务CNAME,比如38b48e4f.example.com。",name:"CNAME",prefix:"cname"},{description:"是否为CNAME,值为1(是)或0(否)。",name:"是否为CNAME",prefix:"isCNAME"},{description:"请求报头中的Referer和Origin值。",name:"请求来源",prefix:"refererOrigin"},{description:"请求报头中的Referer值。",name:"请求来源Referer",prefix:"referer"},{description:"比如Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103。",name:"客户端信息",prefix:"userAgent"},{description:"请求报头的Content-Type。",name:"内容类型",prefix:"contentType"},{description:"比如sid=IxZVPFhE&city=beijing&uid=18237。",name:"所有cookie组合字符串",prefix:"cookies"},{description:"单个cookie值。",name:"单个cookie值",prefix:"cookie"},{description:"比如name=lu&age=20。",name:"所有URL参数组合",prefix:"args"},{description:"单个URL参数值。",name:"单个URL参数值",prefix:"arg"},{description:'使用换行符(\\n)隔开的报头内容字符串,每行均为"NAME: VALUE格式"。',name:"所有请求报头内容",prefix:"headers"},{description:"使用换行符(\\n)隔开的报头名称字符串,每行一个名称。",name:"所有请求报头名称",prefix:"headerNames"},{description:"单个报头值。",name:"单个请求报头值",prefix:"header"},{description:"最长的请求报头的长度。",name:"请求报头最大长度",prefix:"headerMaxLength"},{description:"当前客户端所处国家/地区名称。",name:"国家/地区名称",prefix:"geoCountryName"},{description:"当前客户端所处中国省份名称。",name:"省份名称",prefix:"geoProvinceName"},{description:"当前客户端所处中国城市名称。",name:"城市名称",prefix:"geoCityName"},{description:"当前客户端所处ISP名称。",name:"ISP名称",prefix:"ispName"},{description:"对统计对象进行统计。",name:"CC统计",prefix:"cc2"},{description:"对统计对象进行统计。",name:"防盗链",prefix:"refererBlock"},{description:"统计某段时间段内的请求信息(不推荐再使用,请使用新的CC2统计代替)。",name:"CC统计(旧)",prefix:"cc"},{description:"响应状态码,比如200、404、500。",name:"响应状态码",prefix:"status"},{description:"响应报头值。",name:"响应报头",prefix:"responseHeader"},{description:"响应内容字符串。",name:"响应内容",prefix:"responseBody"},{description:"响应内容长度,通过响应的报头Content-Length获取。",name:"响应内容长度",prefix:"bytesSent"}],window.WAF_RULE_OPERATORS=[{name:"正则匹配",code:"match",description:'使用正则表达式匹配,在头部使用(?i)表示不区分大小写,正则表达式语法 »。',caseInsensitive:"yes",dataType:"regexp"},{name:"正则不匹配",code:"not match",description:'使用正则表达式不匹配,在头部使用(?i)表示不区分大小写,正则表达式语法 »。',caseInsensitive:"yes",dataType:"regexp"},{name:"通配符匹配",code:"wildcard match",description:"判断是否和指定的通配符匹配,可以在对比值中使用星号通配符(*)表示任意字符。",caseInsensitive:"yes",dataType:"wildcard"},{name:"通配符不匹配",code:"wildcard not match",description:"判断是否和指定的通配符不匹配,可以在对比值中使用星号通配符(*)表示任意字符。",caseInsensitive:"yes",dataType:"wildcard"},{name:"字符串等于",code:"eq string",description:"使用字符串对比等于。",caseInsensitive:"no",dataType:"string"},{name:"字符串不等于",code:"neq string",description:"使用字符串对比不等于。",caseInsensitive:"no",dataType:"string"},{name:"包含字符串",code:"contains",description:"包含某个字符串,比如Hello World包含了World。",caseInsensitive:"no",dataType:"string"},{name:"不包含字符串",code:"not contains",description:"不包含某个字符串,比如Hello字符串中不包含Hi。",caseInsensitive:"no",dataType:"string"},{name:"包含任一字符串",code:"contains any",description:"包含字符串列表中的任意一个,比如/hello/world包含/hello和/hi中的/hello,对比值中每行一个字符串。",caseInsensitive:"no",dataType:"strings"},{name:"包含所有字符串",code:"contains all",description:"包含字符串列表中的所有字符串,比如/hello/world必须包含/hello和/world,对比值中每行一个字符串。",caseInsensitive:"no",dataType:"strings"},{name:"包含前缀",code:"prefix",description:"包含字符串前缀部分,比如/hello前缀会匹配/hello, /hello/world等。",caseInsensitive:"no",dataType:"string"},{name:"包含后缀",code:"suffix",description:"包含字符串后缀部分,比如/hello后缀会匹配/hello, /hi/hello等。",caseInsensitive:"no",dataType:"string"},{name:"包含任一单词",code:"contains any word",description:"包含某个独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"包含所有单词",code:"contains all words",description:"包含所有的独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"不包含任一单词",code:"not contains any word",description:"不包含某个独立单词,对比值中每行一个单词,比如mozilla firefox里包含了mozilla和firefox两个单词,但是不包含fire和fox这两个单词。",caseInsensitive:"no",dataType:"strings"},{name:"包含SQL注入",code:"contains sql injection",description:"检测字符串内容是否包含SQL注入。",caseInsensitive:"none",dataType:"none"},{name:"包含SQL注入-严格模式",code:"contains sql injection strictly",description:"更加严格地检测字符串内容是否包含SQL注入,相对于非严格模式,有一定的误报几率。",caseInsensitive:"none",dataType:"none"},{name:"包含XSS注入",code:"contains xss",description:"检测字符串内容是否包含XSS注入。",caseInsensitive:"none",dataType:"none"},{name:"包含XSS注入-严格模式",code:"contains xss strictly",description:"更加严格地检测字符串内容是否包含XSS注入,相对于非严格模式,此时xml、audio、video等标签也会被匹配。",caseInsensitive:"none",dataType:"none"},{name:"包含二进制数据",code:"contains binary",description:"包含一组二进制数据。",caseInsensitive:"no",dataType:"string"},{name:"不包含二进制数据",code:"not contains binary",description:"不包含一组二进制数据。",caseInsensitive:"no",dataType:"string"},{name:"数值大于",code:"gt",description:"使用数值对比大于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值大于等于",code:"gte",description:"使用数值对比大于等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值小于",code:"lt",description:"使用数值对比小于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值小于等于",code:"lte",description:"使用数值对比小于等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值等于",code:"eq",description:"使用数值对比等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"数值不等于",code:"neq",description:"使用数值对比不等于,对比值需要是一个数字。",caseInsensitive:"none",dataType:"number"},{name:"包含索引",code:"has key",description:"对于一组数据拥有某个键值或者索引。",caseInsensitive:"no",dataType:"string|number"},{name:"版本号大于",code:"version gt",description:"对比版本号大于。",caseInsensitive:"none",dataType:"version"},{name:"版本号小于",code:"version lt",description:"对比版本号小于。",caseInsensitive:"none",dataType:"version"},{name:"版本号范围",code:"version range",description:"判断版本号在某个范围内,格式为 起始version1,结束version2。",caseInsensitive:"none",dataType:"versionRange"},{name:"IP等于",code:"eq ip",description:"将参数转换为IP进行对比,只能对比单个IP。",caseInsensitive:"none",dataType:"ip"},{name:"在一组IP中",code:"in ip list",description:"判断参数IP在一组IP内,对比值中每行一个IP。",caseInsensitive:"none",dataType:"ips"},{name:"IP大于",code:"gt ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP大于等于",code:"gte ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP小于",code:"lt ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP小于等于",code:"lte ip",description:"将参数转换为IP进行对比。",caseInsensitive:"none",dataType:"ip"},{name:"IP范围",code:"ip range",description:"IP在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200;或者CIDR格式的ip/bits,比如192.168.2.1/24;或者单个IP。可以填写多行,每行一个IP范围。",caseInsensitive:"none",dataType:"ips"},{name:"不在IP范围",code:"not ip range",description:"IP不在某个范围之内,范围格式可以是英文逗号分隔的开始IP,结束IP,比如192.168.1.100,192.168.2.200;或者CIDR格式的ip/bits,比如192.168.2.1/24;或者单个IP。可以填写多行,每行一个IP范围。",caseInsensitive:"none",dataType:"ips"},{name:"IP取模10",code:"ip mod 10",description:"对IP参数值取模,除数为10,对比值为余数。",caseInsensitive:"none",dataType:"number"},{name:"IP取模100",code:"ip mod 100",description:"对IP参数值取模,除数为100,对比值为余数。",caseInsensitive:"none",dataType:"number"},{name:"IP取模",code:"ip mod",description:"对IP参数值取模,对比值格式为:除数,余数,比如10,1。",caseInsensitive:"none",dataType:"number"}],window.WAF_CAPTCHA_TYPES=[{name:"验证码",code:"default",description:"通过输入验证码来验证人机。",icon:""},{name:"点击验证",code:"oneClick",description:"通过点击界面元素来验证人机。",icon:""},{name:"滑动解锁",code:"slide",description:"通过滑动方块解锁来验证人机。",icon:""},{name:"极验-行为验",code:"geetest",description:"使用极验-行为验提供的人机验证方式。",icon:""}]; diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 46f81c86..867975fc 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -22893,7 +22893,7 @@ window.REQUEST_COND_COMPONENTS = [{"type":"url-extension","name":"文件扩展 window.REQUEST_COND_OPERATORS = [{"description":"判断是否正则表达式匹配","name":"正则表达式匹配","op":"regexp"},{"description":"判断是否正则表达式不匹配","name":"正则表达式不匹配","op":"not regexp"},{"description":"判断是否和指定的通配符匹配","name":"通配符匹配","op":"wildcard match"},{"description":"判断是否和指定的通配符不匹配","name":"通配符不匹配","op":"wildcard not match"},{"description":"使用字符串对比参数值是否相等于某个值","name":"字符串等于","op":"eq"},{"description":"参数值包含某个前缀","name":"字符串前缀","op":"prefix"},{"description":"参数值包含某个后缀","name":"字符串后缀","op":"suffix"},{"description":"参数值包含另外一个字符串","name":"字符串包含","op":"contains"},{"description":"参数值不包含另外一个字符串","name":"字符串不包含","op":"not contains"},{"description":"使用字符串对比参数值是否不相等于某个值","name":"字符串不等于","op":"not"},{"description":"判断参数值在某个列表中","name":"在列表中","op":"in"},{"description":"判断参数值不在某个列表中","name":"不在列表中","op":"not in"},{"description":"判断小写的扩展名(不带点)在某个列表中","name":"扩展名","op":"file ext"},{"description":"判断MimeType在某个列表中,支持类似于image/*的语法","name":"MimeType","op":"mime type"},{"description":"判断版本号在某个范围内,格式为version1,version2","name":"版本号范围","op":"version range"},{"description":"将参数转换为整数数字后进行对比","name":"整数等于","op":"eq int"},{"description":"将参数转换为可以有小数的浮点数字进行对比","name":"浮点数等于","op":"eq float"},{"description":"将参数转换为数字进行对比","name":"数字大于","op":"gt"},{"description":"将参数转换为数字进行对比","name":"数字大于等于","op":"gte"},{"description":"将参数转换为数字进行对比","name":"数字小于","op":"lt"},{"description":"将参数转换为数字进行对比","name":"数字小于等于","op":"lte"},{"description":"对整数参数值取模,除数为10,对比值为余数","name":"整数取模10","op":"mod 10"},{"description":"对整数参数值取模,除数为100,对比值为余数","name":"整数取模100","op":"mod 100"},{"description":"对整数参数值取模,对比值格式为:除数,余数,比如10,1","name":"整数取模","op":"mod"},{"description":"将参数转换为IP进行对比","name":"IP等于","op":"eq ip"},{"description":"将参数转换为IP进行对比","name":"IP大于","op":"gt ip"},{"description":"将参数转换为IP进行对比","name":"IP大于等于","op":"gte ip"},{"description":"将参数转换为IP进行对比","name":"IP小于","op":"lt ip"},{"description":"将参数转换为IP进行对比","name":"IP小于等于","op":"lte ip"},{"description":"IP在某个范围之内,范围格式可以是英文逗号分隔的\u003ccode-label\u003e开始IP,结束IP\u003c/code-label\u003e,比如\u003ccode-label\u003e192.168.1.100,192.168.2.200\u003c/code-label\u003e,或者CIDR格式的ip/bits,比如\u003ccode-label\u003e192.168.2.1/24\u003c/code-label\u003e","name":"IP范围","op":"ip range"},{"description":"对IP参数值取模,除数为10,对比值为余数","name":"IP取模10","op":"ip mod 10"},{"description":"对IP参数值取模,除数为100,对比值为余数","name":"IP取模100","op":"ip mod 100"},{"description":"对IP参数值取模,对比值格式为:除数,余数,比如10,1","name":"IP取模","op":"ip mod"}]; -window.REQUEST_VARIABLES = [{"code":"${edgeVersion}","description":"","name":"边缘节点版本"},{"code":"${remoteAddr}","description":"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适合前端有别的反向代理服务时使用,存在伪造的风险","name":"客户端地址(IP)"},{"code":"${rawRemoteAddr}","description":"返回直接连接服务的客户端原始IP地址","name":"客户端地址(IP)"},{"code":"${remotePort}","description":"","name":"客户端端口"},{"code":"${remoteUser}","description":"","name":"客户端用户名"},{"code":"${requestURI}","description":"比如/hello?name=lily","name":"请求URI"},{"code":"${requestPath}","description":"比如/hello","name":"请求路径(不包括参数)"},{"code":"${requestURL}","description":"比如https://example.com/hello?name=lily","name":"完整的请求URL"},{"code":"${requestLength}","description":"","name":"请求内容长度"},{"code":"${requestMethod}","description":"比如GET、POST","name":"请求方法"},{"code":"${requestFilename}","description":"","name":"请求文件路径"},{"code":"${requestPathExtension}","description":"请求路径中的文件扩展名,包括点符号,比如.html、.png","name":"请求文件扩展名"},{"code":"${requestPathLowerExtension}","description":"请求路径中的文件扩展名,其中大写字母会被自动转换为小写,包括点符号,比如.html、.png","name":"请求文件小写扩展名"},{"code":"${scheme}","description":"","name":"请求协议,http或https"},{"code":"${proto}","description:":"类似于HTTP/1.0","name":"包含版本的HTTP请求协议"},{"code":"${timeISO8601}","description":"比如2018-07-16T23:52:24.839+08:00","name":"ISO 8601格式的时间"},{"code":"${timeLocal}","description":"比如17/Jul/2018:09:52:24 +0800","name":"本地时间"},{"code":"${msec}","description":"比如1531756823.054","name":"带有毫秒的时间"},{"code":"${timestamp}","description":"","name":"unix时间戳,单位为秒"},{"code":"${host}","description":"","name":"主机名"},{"code":"${cname}","description":"比如38b48e4f.goedge.cn","name":"当前网站的CNAME"},{"code":"${serverName}","description":"","name":"接收请求的服务器名"},{"code":"${serverPort}","description":"","name":"接收请求的服务器端口"},{"code":"${referer}","description":"","name":"请求来源URL"},{"code":"${referer.host}","description":"","name":"请求来源URL域名"},{"code":"${userAgent}","description":"","name":"客户端信息"},{"code":"${contentType}","description":"","name":"请求头部的Content-Type"},{"code":"${cookies}","description":"","name":"所有cookie组合字符串"},{"code":"${cookie.NAME}","description":"","name":"单个cookie值"},{"code":"${isArgs}","description":"如果URL有参数,则值为`?`;否则,则值为空","name":"问号(?)标记"},{"code":"${args}","description":"","name":"所有参数组合字符串"},{"code":"${arg.NAME}","description":"","name":"单个参数值"},{"code":"${headers}","description":"","name":"所有Header信息组合字符串"},{"code":"${header.NAME}","description":"","name":"单个Header值"},{"code":"${geo.country.name}","description":"","name":"国家/地区名称"},{"code":"${geo.country.id}","description":"","name":"国家/地区ID"},{"code":"${geo.province.name}","description":"目前只包含中国省份","name":"省份名称"},{"code":"${geo.province.id}","description":"目前只包含中国省份","name":"省份ID"},{"code":"${geo.city.name}","description":"目前只包含中国城市","name":"城市名称"},{"code":"${geo.city.id}","description":"目前只包含中国城市","name":"城市名称"},{"code":"${isp.name}","description":"","name":"ISP服务商名称"},{"code":"${isp.id}","description":"","name":"ISP服务商ID"},{"code":"${browser.os.name}","description":"客户端所在操作系统名称","name":"操作系统名称"},{"code":"${browser.os.version}","description":"客户端所在操作系统版本","name":"操作系统版本"},{"code":"${browser.name}","description":"客户端浏览器名称","name":"浏览器名称"},{"code":"${browser.version}","description":"客户端浏览器版本","name":"浏览器版本"},{"code":"${browser.isMobile}","description":"如果客户端是手机,则值为1,否则为0","name":"手机标识"}]; +window.REQUEST_VARIABLES = [{"code":"${edgeVersion}","description":"","name":"边缘节点版本"},{"code":"${remoteAddr}","description":"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适合前端有别的反向代理服务时使用,存在伪造的风险","name":"客户端地址(IP)"},{"code":"${rawRemoteAddr}","description":"返回直接连接服务的客户端原始IP地址","name":"客户端地址(IP)"},{"code":"${remotePort}","description":"","name":"客户端端口"},{"code":"${remoteUser}","description":"","name":"客户端用户名"},{"code":"${requestURI}","description":"比如/hello?name=lily","name":"请求URI"},{"code":"${requestPath}","description":"比如/hello","name":"请求路径(不包括参数)"},{"code":"${requestURL}","description":"比如https://example.com/hello?name=lily","name":"完整的请求URL"},{"code":"${requestLength}","description":"","name":"请求内容长度"},{"code":"${requestMethod}","description":"比如GET、POST","name":"请求方法"},{"code":"${requestFilename}","description":"","name":"请求文件路径"},{"code":"${requestPathExtension}","description":"请求路径中的文件扩展名,包括点符号,比如.html、.png","name":"请求文件扩展名"},{"code":"${requestPathLowerExtension}","description":"请求路径中的文件扩展名,其中大写字母会被自动转换为小写,包括点符号,比如.html、.png","name":"请求文件小写扩展名"},{"code":"${scheme}","description":"","name":"请求协议,http或https"},{"code":"${proto}","description:":"类似于HTTP/1.0","name":"包含版本的HTTP请求协议"},{"code":"${timeISO8601}","description":"比如2018-07-16T23:52:24.839+08:00","name":"ISO 8601格式的时间"},{"code":"${timeLocal}","description":"比如17/Jul/2018:09:52:24 +0800","name":"本地时间"},{"code":"${msec}","description":"比如1531756823.054","name":"带有毫秒的时间"},{"code":"${timestamp}","description":"","name":"unix时间戳,单位为秒"},{"code":"${host}","description":"","name":"主机名"},{"code":"${cname}","description":"比如38b48e4f.goedge.cloud","name":"当前网站的CNAME"},{"code":"${serverName}","description":"","name":"接收请求的服务器名"},{"code":"${serverPort}","description":"","name":"接收请求的服务器端口"},{"code":"${referer}","description":"","name":"请求来源URL"},{"code":"${referer.host}","description":"","name":"请求来源URL域名"},{"code":"${userAgent}","description":"","name":"客户端信息"},{"code":"${contentType}","description":"","name":"请求头部的Content-Type"},{"code":"${cookies}","description":"","name":"所有cookie组合字符串"},{"code":"${cookie.NAME}","description":"","name":"单个cookie值"},{"code":"${isArgs}","description":"如果URL有参数,则值为`?`;否则,则值为空","name":"问号(?)标记"},{"code":"${args}","description":"","name":"所有参数组合字符串"},{"code":"${arg.NAME}","description":"","name":"单个参数值"},{"code":"${headers}","description":"","name":"所有Header信息组合字符串"},{"code":"${header.NAME}","description":"","name":"单个Header值"},{"code":"${geo.country.name}","description":"","name":"国家/地区名称"},{"code":"${geo.country.id}","description":"","name":"国家/地区ID"},{"code":"${geo.province.name}","description":"目前只包含中国省份","name":"省份名称"},{"code":"${geo.province.id}","description":"目前只包含中国省份","name":"省份ID"},{"code":"${geo.city.name}","description":"目前只包含中国城市","name":"城市名称"},{"code":"${geo.city.id}","description":"目前只包含中国城市","name":"城市名称"},{"code":"${isp.name}","description":"","name":"ISP服务商名称"},{"code":"${isp.id}","description":"","name":"ISP服务商ID"},{"code":"${browser.os.name}","description":"客户端所在操作系统名称","name":"操作系统名称"},{"code":"${browser.os.version}","description":"客户端所在操作系统版本","name":"操作系统版本"},{"code":"${browser.name}","description":"客户端浏览器名称","name":"浏览器名称"},{"code":"${browser.version}","description":"客户端浏览器版本","name":"浏览器版本"},{"code":"${browser.isMobile}","description":"如果客户端是手机,则值为1,否则为0","name":"手机标识"}]; window.METRIC_HTTP_KEYS = [{"name":"客户端地址(IP)","code":"${remoteAddr}","description":"会依次根据X-Forwarded-For、X-Real-IP、RemoteAddr获取,适用于前端可能有别的反向代理的情形,存在被伪造的可能","icon":""},{"name":"直接客户端地址(IP)","code":"${rawRemoteAddr}","description":"返回直接连接服务的客户端原始IP地址","icon":""},{"name":"客户端用户名","code":"${remoteUser}","description":"通过基本认证填入的用户名","icon":""},{"name":"请求URI","code":"${requestURI}","description":"包含参数,比如/hello?name=lily","icon":""},{"name":"请求路径","code":"${requestPath}","description":"不包含参数,比如/hello","icon":""},{"name":"完整URL","code":"${requestURL}","description":"比如https://example.com/hello?name=lily","icon":""},{"name":"请求方法","code":"${requestMethod}","description":"比如GET、POST等","icon":""},{"name":"请求协议Scheme","code":"${scheme}","description":"http或https","icon":""},{"name":"文件扩展名","code":"${requestPathExtension}","description":"请求路径中的文件扩展名,包括点符号,比如.html、.png","icon":""},{"name":"小写文件扩展名","code":"${requestPathLowerExtension}","description":"请求路径中的文件扩展名小写形式,包括点符号,比如.html、.png","icon":""},{"name":"主机名","code":"${host}","description":"通常是请求的域名","icon":""},{"name":"HTTP协议","code":"${proto}","description":"包含版本的HTTP请求协议,类似于HTTP/1.0","icon":""},{"name":"URL参数值","code":"${arg.NAME}","description":"单个URL参数值","icon":""},{"name":"请求来源URL","code":"${referer}","description":"请求来源Referer URL","icon":""},{"name":"请求来源URL域名","code":"${referer.host}","description":"请求来源Referer URL域名","icon":""},{"name":"Header值","code":"${header.NAME}","description":"单个Header值,比如${header.User-Agent}","icon":""},{"name":"Cookie值","code":"${cookie.NAME}","description":"单个cookie值,比如${cookie.sid}","icon":""},{"name":"状态码","code":"${status}","description":"","icon":""},{"name":"响应的Content-Type值","code":"${response.contentType}","description":"","icon":""}]; diff --git a/web/public/js/components/server/http-firewall-provider-selector.js b/web/public/js/components/server/http-firewall-provider-selector.js new file mode 100644 index 00000000..16b3ec78 --- /dev/null +++ b/web/public/js/components/server/http-firewall-provider-selector.js @@ -0,0 +1,55 @@ +Vue.component("http-firewall-provider-selector", { + props: ["v-type", "v-providers"], + data: function () { + let providers = this.vProviders + if (providers == null) { + providers = [] + } + + return { + listType: this.vType, + providers: providers + } + }, + methods: { + addProvider: function () { + let selectedProviderIds = this.providers.map(function (provider) { + return provider.id + }) + let that = this + teaweb.popup("/servers/server/settings/waf/ipadmin/selectProvidersPopup?type=" + this.listType + "&selectedProviderIds=" + selectedProviderIds.join(","), { + width: "50em", + height: "26em", + callback: function (resp) { + that.providers = resp.data.selectedProviders + that.$forceUpdate() + that.notifyChange() + } + }) + }, + removeProvider: function (index) { + this.providers.$remove(index) + this.notifyChange() + }, + resetProviders: function () { + this.providers = [] + this.notifyChange() + }, + notifyChange: function () { + this.$emit("change", { + "providers": this.providers + }) + } + }, + template: `
+ 暂时没有选择允许封禁的运营商。 +
+
+ + {{provider.name}} +
+
+
+   +
` +}) \ No newline at end of file diff --git a/web/views/@default/@footer.html b/web/views/@default/@footer.html index 6daeaf36..4a81ff8d 100644 --- a/web/views/@default/@footer.html +++ b/web/views/@default/@footer.html @@ -4,6 +4,6 @@ 文档 GitHub 提Bug - + 企业版 \ No newline at end of file diff --git a/web/views/@default/clusters/cluster/createNode.html b/web/views/@default/clusters/cluster/createNode.html index c25a9fe6..f2ab24de 100644 --- a/web/views/@default/clusters/cluster/createNode.html +++ b/web/views/@default/clusters/cluster/createNode.html @@ -57,6 +57,28 @@

设置区域后可以根据区域进行流量统计和计费。

+ + + 所属从集群 + +
+
+ + + + + +
+
+
{{cluster.name}}  
+
+
+ +
+
+
+
+ diff --git a/web/views/@default/clusters/cluster/createNode.js b/web/views/@default/clusters/cluster/createNode.js index e660adfc..c5d08106 100644 --- a/web/views/@default/clusters/cluster/createNode.js +++ b/web/views/@default/clusters/cluster/createNode.js @@ -24,6 +24,30 @@ Tea.context(function () { }) } + this.secondaryClusters = [] + this.secondaryClusterIds = this.secondaryClusters.map(function (v) { + return v.id + }) + + this.addSecondary = function () { + let that = this + let selectedClusterIds = [this.clusterId].concat(this.secondaryClusterIds) + teaweb.popup("/clusters/selectPopup?selectedClusterIds=" + selectedClusterIds.join(",") + "&mode=multiple", { + height: "30em", + width: "50em", + callback: function (resp) { + if (resp.data.cluster != null) { + that.secondaryClusterIds.push(resp.data.cluster.id) + that.secondaryClusters.push(resp.data.cluster) + } + } + }) + } + this.removeSecondary = function (index) { + this.secondaryClusterIds.$remove(index) + this.secondaryClusters.$remove(index) + } + /** * 安装 */ @@ -35,6 +59,7 @@ Tea.context(function () { this.installMethod = method } + this.selectSSHHost = function (host) { this.sshHost = host this.changeSSHHost() diff --git a/web/views/@default/clusters/cluster/node/settings/system/index.html b/web/views/@default/clusters/cluster/node/settings/system/index.html index 18d15b1c..328cde19 100644 --- a/web/views/@default/clusters/cluster/node/settings/system/index.html +++ b/web/views/@default/clusters/cluster/node/settings/system/index.html @@ -14,6 +14,23 @@

当前节点可以使用的最多的CPU线程数,如果为0则默认为总的CPU线程数。

+ + BYPASS 移动 + +
+ + +
+

选中后,可优化移动网络访问成功率,对于正常站点,会增加访问延迟,节点需安装nftables。

+ + + + BYPASS 移动,窗口大小 + + +

TCP接收窗口大小,默认值17。

+ +

DNS解析

diff --git a/web/views/@default/clusters/cluster/node/settings/system/index.js b/web/views/@default/clusters/cluster/node/settings/system/index.js index 295a9aaf..4f23d01a 100644 --- a/web/views/@default/clusters/cluster/node/settings/system/index.js +++ b/web/views/@default/clusters/cluster/node/settings/system/index.js @@ -1,3 +1,11 @@ Tea.context(function () { this.success = NotifyReloadSuccess("保存成功") + + this.changeBypassMobile = function(bypassMobile) { + if (bypassMobile.target.checked) { + this.node.bypassMobile = 17; + } else { + this.node.bypassMobile = 0; + } + } }) \ No newline at end of file diff --git a/web/views/@default/dns/providers/createPopup.html b/web/views/@default/dns/providers/createPopup.html index 217d9f99..d948ffae 100644 --- a/web/views/@default/dns/providers/createPopup.html +++ b/web/views/@default/dns/providers/createPopup.html @@ -15,7 +15,6 @@ 服务商厂家 *

{{typeDescription}} 系统会保留原有域名下的域名解析,请放心使用。购买商业版可获得更多厂商支持。

diff --git a/web/views/@default/dns/providers/createPopup.js b/web/views/@default/dns/providers/createPopup.js index 9ac08b10..34166bf0 100644 --- a/web/views/@default/dns/providers/createPopup.js +++ b/web/views/@default/dns/providers/createPopup.js @@ -1,7 +1,7 @@ Tea.context(function () { this.success = NotifyPopup - this.type = "" - this.typeDescription = "" + this.type = "dnsla" + this.typeDescription = "DNS.LA提供的DNS服务。" this.changeType = function () { let that = this diff --git a/web/views/@default/servers/components/waf/ipadmin/@menu.html b/web/views/@default/servers/components/waf/ipadmin/@menu.html index 0a78ea26..b1ae3791 100644 --- a/web/views/@default/servers/components/waf/ipadmin/@menu.html +++ b/web/views/@default/servers/components/waf/ipadmin/@menu.html @@ -1,6 +1,7 @@ 国家/地区封禁 省份封禁 + 运营商封禁 | 白名单 黑名单 diff --git a/web/views/@default/servers/components/waf/ipadmin/providers.html b/web/views/@default/servers/components/waf/ipadmin/providers.html new file mode 100644 index 00000000..b26b43ac --- /dev/null +++ b/web/views/@default/servers/components/waf/ipadmin/providers.html @@ -0,0 +1,46 @@ +{$layout} + +{$template "../waf_menu"} +{$template "menu"} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
仅允许的运营商 + +
仅封禁的运营商 +

由于你已设置"仅允许的运营商",所以不需要再设置封禁运营商。

+ +
例外URL  
限制URL  
提示内容 + +

当客户端所在区域被封禁时提示页面的HTML内容;不填则表示使用默认的提示内容;支持请求变量。

+
+ +
\ No newline at end of file diff --git a/web/views/@default/servers/components/waf/ipadmin/providers.js b/web/views/@default/servers/components/waf/ipadmin/providers.js new file mode 100644 index 00000000..42502d23 --- /dev/null +++ b/web/views/@default/servers/components/waf/ipadmin/providers.js @@ -0,0 +1,11 @@ +Tea.context(function () { + this.success = function () { + teaweb.success("保存成功", function () { + teaweb.reload() + }) + } + + this.changeAllowedProviders = function (event) { + this.allowedProviders = event.providers + } +}) \ No newline at end of file diff --git a/web/views/@default/servers/server/settings/https/requestCertPopup.html b/web/views/@default/servers/server/settings/https/requestCertPopup.html index 5b85b60f..283b09f3 100644 --- a/web/views/@default/servers/server/settings/https/requestCertPopup.html +++ b/web/views/@default/servers/server/settings/https/requestCertPopup.html @@ -18,7 +18,7 @@ - + 证书用户 *
@@ -35,6 +35,24 @@
+ + 异步申请证书 + + 启用 +

建议域名多的时候勾选,异步并发执行证书申请,申请成功后会自动绑定到服务

+ + + + 证书类型 + +
+ +
+

选择证书类型。

+ + 提交 diff --git a/web/views/@default/servers/server/settings/https/requestCertPopup.js b/web/views/@default/servers/server/settings/https/requestCertPopup.js index 4606236a..0c23428e 100644 --- a/web/views/@default/servers/server/settings/https/requestCertPopup.js +++ b/web/views/@default/servers/server/settings/https/requestCertPopup.js @@ -1,6 +1,8 @@ Tea.context(function () { this.isRequesting = false this.userId = 0 + this.asyncCreateCert = false + this.providerCode = "letsencrypt" this.remove = function (index) { this.serverNames.$remove(index) diff --git a/web/views/@default/servers/server/settings/waf/@menu.html b/web/views/@default/servers/server/settings/waf/@menu.html index 46ccc194..ef85a0b9 100644 --- a/web/views/@default/servers/server/settings/waf/@menu.html +++ b/web/views/@default/servers/server/settings/waf/@menu.html @@ -5,6 +5,7 @@ | 国家/地区封禁 省份封禁 + 运营商封禁 白名单 黑名单 灰名单 diff --git a/web/views/@default/servers/server/settings/waf/ipadmin/providers.html b/web/views/@default/servers/server/settings/waf/ipadmin/providers.html new file mode 100644 index 00000000..f13c7978 --- /dev/null +++ b/web/views/@default/servers/server/settings/waf/ipadmin/providers.html @@ -0,0 +1,59 @@ +{$layout} +{$template "../../settings_menu"} +{$template "/left_menu_with_menu"} + +
+ {$template "../menu"} + + 尚未为当前用户开通此功能。 + + {$ if .featureIsOn} + 当前WAF未启用,设置将在[启用Web防火墙]后生效。 + 当前网站所在集群的WAF策略模式为 + {{clusterFirewallPolicy.modeInfo.name}} + 非防御模式,当前设置将不会生效。 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
仅允许的运营商 + +
仅封禁的运营商 +

由于你已设置"仅允许的运营商",所以不需要再设置封禁运营商。

+ +
例外URL  
限制URL  
提示内容 + +

当客户端所在运营商被封禁时提示页面的HTML内容;不填则表示使用默认的提示内容;支持请求变量。

+
+ +
+ {$end} +
\ No newline at end of file diff --git a/web/views/@default/servers/server/settings/waf/ipadmin/providers.js b/web/views/@default/servers/server/settings/waf/ipadmin/providers.js new file mode 100644 index 00000000..42502d23 --- /dev/null +++ b/web/views/@default/servers/server/settings/waf/ipadmin/providers.js @@ -0,0 +1,11 @@ +Tea.context(function () { + this.success = function () { + teaweb.success("保存成功", function () { + teaweb.reload() + }) + } + + this.changeAllowedProviders = function (event) { + this.allowedProviders = event.providers + } +}) \ No newline at end of file diff --git a/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.css b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.css new file mode 100644 index 00000000..1a140c75 --- /dev/null +++ b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.css @@ -0,0 +1,10 @@ +.providers-list .item { + float: left; + width: 12em; + margin-bottom: 0.5em; +} + +.providers-list .item .checkbox label { + font-size: 12px !important; + cursor: pointer !important; +} \ No newline at end of file diff --git a/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.html b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.html new file mode 100644 index 00000000..33ab3c48 --- /dev/null +++ b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.html @@ -0,0 +1,32 @@ +{$layout "layout_popup"} + +

选择允许的运营商

+

选择封禁的运营商

+ +
+ + + + +
+ +
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+ +
\ No newline at end of file diff --git a/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.js b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.js new file mode 100644 index 00000000..b29db256 --- /dev/null +++ b/web/views/@default/servers/server/settings/waf/ipadmin/selectProvidersPopup.js @@ -0,0 +1,46 @@ +Tea.context(function () { + this.isCheckingAll = false + + this.countSelectedProviders = this.providers.$count(function (k, provider) { + return provider.isChecked + }) + + this.selectProvider = function (provider) { + provider.isChecked = !provider.isChecked + this.change() + } + + this.deselectProvider = function (provider) { + provider.isChecked = false + this.change() + } + + this.checkAll = function () { + this.isCheckingAll = !this.isCheckingAll + let that = this + this.providers.forEach(function (provider) { + provider.isChecked = that.isCheckingAll + }) + + this.change() + } + + this.change = function () { + + } + + this.submit = function () { + let selectedProviders = [] + this.providers.forEach(function (provider) { + if (provider.isChecked) { + selectedProviders.push(provider) + } + }) + NotifyPopup({ + code: 200, + data: { + selectedProviders: selectedProviders + } + }) + } +}) \ No newline at end of file diff --git a/web/views/@default/setup/mysql/installPopup.html b/web/views/@default/setup/mysql/installPopup.html index df0f3bd4..b9620206 100644 --- a/web/views/@default/setup/mysql/installPopup.html +++ b/web/views/@default/setup/mysql/installPopup.html @@ -24,7 +24,7 @@ 可以在你要安装MySQL的服务器上运行以下命令(目前仅支持Linux系统和X86架构服务器,安装后的MySQL版本是8.x.x): - sudo sh -c "$(wget https://goedge.cn/install-mysql.sh -O -)" + sudo sh -c "$(wget https://goedge.cloud/install-mysql.sh -O -)"