From 1f1d6d9a876951fe02b8938dc06ca1f27daeccf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 25 Jul 2026 22:57:06 +0800 Subject: [PATCH] Fix string type --- common/tls/std_client.go | 2 +- common/tls/std_server.go | 2 +- common/tls/utls_client.go | 2 +- protocol/ssh/outbound.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/tls/std_client.go b/common/tls/std_client.go index 1611c83e..56b9e618 100644 --- a/common/tls/std_client.go +++ b/common/tls/std_client.go @@ -165,7 +165,7 @@ func NewSTDClient(ctx context.Context, logger logger.ContextLogger, serverAddres if len(certificate) > 0 { certPool := x509.NewCertPool() if !certPool.AppendCertsFromPEM(certificate) { - return nil, E.New("failed to parse certificate:\n\n", certificate) + return nil, E.New("failed to parse certificate:\n\n", string(certificate)) } tlsConfig.RootCAs = certPool } diff --git a/common/tls/std_server.go b/common/tls/std_server.go index a1a2a611..acc19019 100644 --- a/common/tls/std_server.go +++ b/common/tls/std_server.go @@ -171,7 +171,7 @@ func (c *STDServerConfig) certificateUpdated(path string) error { for _, certPath := range c.clientCertificatePath { content, err := os.ReadFile(certPath) if err != nil { - c.logger.Error(E.Cause(err, "reload certificate from ", c.clientCertificatePath)) + c.logger.Error(E.Cause(err, "reload certificate from ", certPath)) continue } if !clientCertificateCA.AppendCertsFromPEM(content) { diff --git a/common/tls/utls_client.go b/common/tls/utls_client.go index 941192ba..1db3e493 100644 --- a/common/tls/utls_client.go +++ b/common/tls/utls_client.go @@ -218,7 +218,7 @@ func NewUTLSClient(ctx context.Context, logger logger.ContextLogger, serverAddre if len(certificate) > 0 { certPool := x509.NewCertPool() if !certPool.AppendCertsFromPEM(certificate) { - return nil, E.New("failed to parse certificate:\n\n", certificate) + return nil, E.New("failed to parse certificate:\n\n", string(certificate)) } tlsConfig.RootCAs = certPool } diff --git a/protocol/ssh/outbound.go b/protocol/ssh/outbound.go index b2f96807..b76c79ad 100644 --- a/protocol/ssh/outbound.go +++ b/protocol/ssh/outbound.go @@ -103,7 +103,7 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL for _, hostKey := range options.HostKey { key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(hostKey)) if err != nil { - return nil, E.New("parse host key ", key) + return nil, E.Cause(err, "parse host key: ", hostKey) } outbound.hostKey = append(outbound.hostKey, key) }