From f89b987d8b1ec57378a7a20a5fd66182e3299ebd Mon Sep 17 00:00:00 2001 From: helei Date: Thu, 8 Jan 2026 19:41:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?etcd=20=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: helei --- db/etcd/etcd.client.go | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/db/etcd/etcd.client.go b/db/etcd/etcd.client.go index 0121c26..427e435 100644 --- a/db/etcd/etcd.client.go +++ b/db/etcd/etcd.client.go @@ -2,10 +2,11 @@ package etcd import ( "context" + "time" + tlsconfig "github.com/helays/utils/v2/crypto/tls.config" "github.com/helays/utils/v2/tools" "go.etcd.io/etcd/client/v3" - "time" ) type Config struct { @@ -28,33 +29,33 @@ type Config struct { } // NewClient 创建etcd客户端 -func (this Config) NewClient(ctx context.Context) (*clientv3.Client, error) { - c := clientv3.Config{ - Endpoints: this.Endpoints, - AutoSyncInterval: tools.AutoTimeDuration(this.AutoSyncInterval, time.Second), - DialTimeout: tools.AutoTimeDuration(this.DialTimeout, time.Second, 10*time.Second), - DialKeepAliveTime: tools.AutoTimeDuration(this.DialKeepAliveTime, time.Second), - DialKeepAliveTimeout: tools.AutoTimeDuration(this.DialKeepAliveTimeout, time.Second), - MaxCallSendMsgSize: this.MaxCallSendMsgSize, - MaxCallRecvMsgSize: this.MaxCallRecvMsgSize, - Username: this.Username, - Password: this.Password, - RejectOldCluster: this.RejectOldCluster, +func (c *Config) NewClient(ctx context.Context) (*clientv3.Client, error) { + cfg := clientv3.Config{ + Endpoints: c.Endpoints, + AutoSyncInterval: tools.AutoTimeDuration(c.AutoSyncInterval, time.Second), + DialTimeout: tools.AutoTimeDuration(c.DialTimeout, time.Second, 10*time.Second), + DialKeepAliveTime: tools.AutoTimeDuration(c.DialKeepAliveTime, time.Second), + DialKeepAliveTimeout: tools.AutoTimeDuration(c.DialKeepAliveTimeout, time.Second), + MaxCallSendMsgSize: c.MaxCallSendMsgSize, + MaxCallRecvMsgSize: c.MaxCallRecvMsgSize, + Username: c.Username, + Password: c.Password, + RejectOldCluster: c.RejectOldCluster, Context: ctx, - PermitWithoutStream: this.PermitWithoutStream, - MaxUnaryRetries: this.MaxUnaryRetries, - BackoffWaitBetween: tools.AutoTimeDuration(this.BackoffWaitBetween, time.Second), - BackoffJitterFraction: this.BackoffJitterFraction, + PermitWithoutStream: c.PermitWithoutStream, + MaxUnaryRetries: c.MaxUnaryRetries, + BackoffWaitBetween: tools.AutoTimeDuration(c.BackoffWaitBetween, time.Second), + BackoffJitterFraction: c.BackoffJitterFraction, } - // 使用tls - if this.EnableTLS { - // 使用tls - tlsConfig, err := this.TLS.NewTLSConfig() + // 使用 tls + if c.EnableTLS { + // 使用 tls + tlsConfig, err := c.TLS.NewTLSConfig() if err != nil { return nil, err } - c.TLS = tlsConfig + cfg.TLS = tlsConfig } - return clientv3.New(c) + return clientv3.New(cfg) } From 47cf93844c367f8ac2fffb7d6a5ee44bcfce7156 Mon Sep 17 00:00:00 2001 From: helei Date: Mon, 19 Jan 2026 16:29:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: helei --- go.mod | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 48d6bf8..75632fa 100644 --- a/go.mod +++ b/go.mod @@ -21,15 +21,15 @@ require ( github.com/gorilla/handlers v1.5.2 github.com/gorilla/schema v1.4.1 github.com/helays/gomail/v2 v2.0.3 - github.com/jackc/pgx/v5 v5.7.6 + github.com/jackc/pgx/v5 v5.8.0 github.com/jlaffaye/ftp v0.2.0 github.com/malfunkt/iprange v0.9.0 - github.com/minio/minio-go/v7 v7.0.97 + github.com/minio/minio-go/v7 v7.0.98 github.com/nacos-group/nacos-sdk-go/v2 v2.3.5 github.com/natefinch/lumberjack v2.0.0+incompatible github.com/pkg/errors v0.9.1 github.com/pkg/sftp v1.13.10 - github.com/quic-go/quic-go v0.58.0 + github.com/quic-go/quic-go v0.59.0 github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 github.com/redis/go-redis/v9 v9.17.2 github.com/robfig/cron/v3 v3.0.1 @@ -41,11 +41,11 @@ require ( go.etcd.io/etcd/client/v3 v3.6.7 go.uber.org/zap v1.27.1 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/crypto v0.46.0 - golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 - golang.org/x/net v0.48.0 - golang.org/x/text v0.32.0 - gopkg.in/ini.v1 v1.67.0 + golang.org/x/crypto v0.47.0 + golang.org/x/exp v0.0.0-20260112195511-716be5621a96 + golang.org/x/net v0.49.0 + golang.org/x/text v0.33.0 + gopkg.in/ini.v1 v1.67.1 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.6.0 @@ -61,14 +61,14 @@ require ( github.com/alibabacloud-go/darabonba-array v0.1.0 // indirect github.com/alibabacloud-go/darabonba-encode-util v0.0.2 // indirect github.com/alibabacloud-go/darabonba-map v0.0.2 // indirect - github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13 // indirect + github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.14 // indirect github.com/alibabacloud-go/darabonba-signature-util v0.0.7 // indirect github.com/alibabacloud-go/darabonba-string v1.0.2 // indirect github.com/alibabacloud-go/debug v1.0.1 // indirect github.com/alibabacloud-go/endpoint-util v1.1.1 // indirect github.com/alibabacloud-go/kms-20160120/v3 v3.4.0 // indirect - github.com/alibabacloud-go/openapi-util v0.1.1 // indirect - github.com/alibabacloud-go/tea v1.3.14 // indirect + github.com/alibabacloud-go/openapi-util v0.1.2 // indirect + github.com/alibabacloud-go/tea v1.4.0 // indirect github.com/alibabacloud-go/tea-utils/v2 v2.0.9 // indirect github.com/alibabacloud-go/tea-xml v1.1.3 // indirect github.com/aliyun/alibaba-cloud-sdk-go v1.63.107 // indirect @@ -102,12 +102,12 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.30.1 // indirect - github.com/goccy/go-yaml v1.19.1 // indirect + github.com/goccy/go-yaml v1.19.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.7.0-rc.1 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v1.0.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect @@ -124,13 +124,13 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.18.2 // indirect + github.com/klauspost/compress v1.18.3 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/crc32 v1.3.0 // indirect github.com/kr/fs v0.1.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-sqlite3 v1.14.32 // indirect + github.com/mattn/go-sqlite3 v1.14.33 // indirect github.com/minio/crc64nvme v1.1.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -140,18 +140,18 @@ require ( github.com/orcaman/concurrent-map v1.0.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/philhofer/fwd v1.2.0 // indirect - github.com/pierrec/lz4/v4 v4.1.23 // indirect + github.com/pierrec/lz4/v4 v4.1.25 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.4 // indirect + github.com/prometheus/common v0.67.5 // indirect github.com/prometheus/procfs v0.19.2 // indirect github.com/quic-go/qpack v0.6.0 // indirect - github.com/richardlehane/mscfb v1.0.4 // indirect - github.com/richardlehane/msoleps v1.0.4 // indirect + github.com/richardlehane/mscfb v1.0.6 // indirect + github.com/richardlehane/msoleps v1.0.6 // indirect github.com/rs/xid v1.6.0 // indirect github.com/tiendc/go-deepcopy v1.7.2 // indirect - github.com/tinylib/msgp v1.6.1 // indirect + github.com/tinylib/msgp v1.6.3 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect @@ -168,18 +168,22 @@ require ( go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.23.0 // indirect golang.org/x/sync v0.19.0 // indirect - golang.org/x/sys v0.39.0 // indirect + golang.org/x/sys v0.40.0 // indirect golang.org/x/time v0.14.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect + google.golang.org/genproto v0.0.0-20260114163908-3f89685c29c3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260114163908-3f89685c29c3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 // indirect google.golang.org/grpc v1.78.0 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect ) +replace github.com/go-ini/ini => gopkg.in/ini.v1 v1.67.1 + // google.golang.org/genproto v0.0.0-20251111163417-95abcf5c77ba // indirect // google.golang.org/genproto/googleapis/api v0.0.0-20251124214823-79d6a2a48846 // indirect // google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect From 590aa91e659b83f8f18e396ac57429f1c51a7bd9 Mon Sep 17 00:00:00 2001 From: helei Date: Mon, 19 Jan 2026 16:32:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: helei --- go.mod | 1 - 1 file changed, 1 deletion(-) diff --git a/go.mod b/go.mod index 75632fa..285c2aa 100644 --- a/go.mod +++ b/go.mod @@ -182,7 +182,6 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect ) -replace github.com/go-ini/ini => gopkg.in/ini.v1 v1.67.1 // google.golang.org/genproto v0.0.0-20251111163417-95abcf5c77ba // indirect // google.golang.org/genproto/googleapis/api v0.0.0-20251124214823-79d6a2a48846 // indirect