From a474b8484b875322a6280ed7bd550330fdeef0eb Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:39:45 +0800 Subject: [PATCH 1/3] ddns: replace tencentcloud implemention (#462) --- go.mod | 4 ++-- go.sum | 9 +++++---- service/singleton/ddns.go | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 4a99117..b205e50 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( github.com/json-iterator/go v1.1.12 github.com/libdns/cloudflare v0.1.1 github.com/libdns/libdns v0.2.2 - github.com/libdns/tencentcloud v1.0.0 github.com/miekg/dns v1.1.62 + github.com/nezhahq/libdns-tencentcloud v0.0.0-20241029120103-889957240fff github.com/nicksnyder/go-i18n/v2 v2.4.0 github.com/ory/graceful v0.1.3 github.com/oschwald/maxminddb-golang v1.13.1 @@ -75,9 +75,9 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.597 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect go.uber.org/atomic v1.9.0 // indirect diff --git a/go.sum b/go.sum index 14f23c5..4dff396 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,6 @@ github.com/libdns/cloudflare v0.1.1 h1:FVPfWwP8zZCqj268LZjmkDleXlHPlFU9KC4OJ3yn0 github.com/libdns/cloudflare v0.1.1/go.mod h1:9VK91idpOjg6v7/WbjkEW49bSCxj00ALesIFDhJ8PBU= github.com/libdns/libdns v0.2.2 h1:O6ws7bAfRPaBsgAYt8MDe2HcNBGC29hkZ9MX2eUSX3s= github.com/libdns/libdns v0.2.2/go.mod h1:4Bj9+5CQiNMVGf87wjX4CY3HQJypUHRuLvlsfsZqLWQ= -github.com/libdns/tencentcloud v1.0.0 h1:u4LXnYu/lu/9P5W+MCVPeSDnwI+6w+DxYhQ1wSnQOuU= -github.com/libdns/tencentcloud v1.0.0/go.mod h1:NlCgPumzUsZWSOo1+Q/Hfh8G6TNRAaTUeWQdg6LbtUI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -131,6 +129,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/nezhahq/libdns-tencentcloud v0.0.0-20241029120103-889957240fff h1:3WDsbsg3dmsRENYLUPGPTkEcWWmTvk41i+rM91AIIbY= +github.com/nezhahq/libdns-tencentcloud v0.0.0-20241029120103-889957240fff/go.mod h1:k+cDtTbUY+UV56Aqv4Ahmc9bWmhpga9JJXZlAIPKBEc= github.com/nicksnyder/go-i18n/v2 v2.4.0 h1:3IcvPOAvnCKwNm0TB0dLDTuawWEj+ax/RERNC+diLMM= github.com/nicksnyder/go-i18n/v2 v2.4.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7gMc814+6wVyEI4= github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= @@ -188,14 +188,15 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.597 h1:C0GHdLTfikLVoEzfhgPfrZ7LwlG0xiCmk6iwNKE+xs0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.597/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= diff --git a/service/singleton/ddns.go b/service/singleton/ddns.go index 312516e..81b81da 100644 --- a/service/singleton/ddns.go +++ b/service/singleton/ddns.go @@ -5,7 +5,7 @@ import ( "sync" "github.com/libdns/cloudflare" - "github.com/libdns/tencentcloud" + tencentcloud "github.com/nezhahq/libdns-tencentcloud" "github.com/naiba/nezha/model" ddns2 "github.com/naiba/nezha/pkg/ddns" @@ -45,6 +45,7 @@ func GetDDNSProvidersFromProfiles(profileId []uint64, ip *ddns2.IP) ([]*ddns2.Pr if profile, ok := ddnsCache[id]; ok { profiles = append(profiles, profile) } else { + ddnsCacheLock.RUnlock() return nil, fmt.Errorf("无法找到DDNS配置 ID %d", id) } } From 61fdcd2a9e652a6cf4bcf5f6ee163d0b46563992 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Thu, 31 Oct 2024 00:15:41 +0800 Subject: [PATCH 2/3] fix(cli): display version before init app (#463) --- cmd/dashboard/main.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index b59b320..6c68653 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -1,6 +1,7 @@ package main import ( + "os" "context" "fmt" "log" @@ -32,13 +33,6 @@ func init() { flag.StringVarP(&dashboardCliParam.ConfigFile, "config", "c", "data/config.yaml", "配置文件路径") flag.StringVar(&dashboardCliParam.DatebaseLocation, "db", "data/sqlite.db", "Sqlite3数据库文件路径") flag.Parse() - - // 初始化 dao 包 - singleton.InitConfigFromPath(dashboardCliParam.ConfigFile) - singleton.InitTimezoneAndCache() - singleton.InitDBFromPath(dashboardCliParam.DatebaseLocation) - singleton.InitLocalizer() - initSystem() } func initSystem() { @@ -59,9 +53,16 @@ func initSystem() { func main() { if dashboardCliParam.Version { fmt.Println(singleton.Version) - return + os.Exit(0) } + // 初始化 dao 包 + singleton.InitConfigFromPath(dashboardCliParam.ConfigFile) + singleton.InitTimezoneAndCache() + singleton.InitDBFromPath(dashboardCliParam.DatebaseLocation) + singleton.InitLocalizer() + initSystem() + // TODO 使用 cmux 在同一端口服务 HTTP 和 gRPC singleton.CleanMonitorHistory() go rpc.ServeRPC(singleton.Conf.GRPCPort) From 45b0f1edfc03ca0418be92319fa7ef5881b6bc37 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Oct 2024 16:15:58 +0000 Subject: [PATCH 3/3] update contributors[no ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 98b970c..cf1c450 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ You can change the dashboard language in the settings page (`/setting`) after th Tao Chen Spetrum Nanjing Hopefun Network Technology Co. Ltd. +Moraxyc Mingzhuo Yin Martijn Lindeman MadDogOwner