Fix string type

This commit is contained in:
世界
2026-07-25 22:57:06 +08:00
parent cb0051d64d
commit 1f1d6d9a87
4 changed files with 4 additions and 4 deletions

View File

@@ -165,7 +165,7 @@ func NewSTDClient(ctx context.Context, logger logger.ContextLogger, serverAddres
if len(certificate) > 0 { if len(certificate) > 0 {
certPool := x509.NewCertPool() certPool := x509.NewCertPool()
if !certPool.AppendCertsFromPEM(certificate) { 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 tlsConfig.RootCAs = certPool
} }

View File

@@ -171,7 +171,7 @@ func (c *STDServerConfig) certificateUpdated(path string) error {
for _, certPath := range c.clientCertificatePath { for _, certPath := range c.clientCertificatePath {
content, err := os.ReadFile(certPath) content, err := os.ReadFile(certPath)
if err != nil { 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 continue
} }
if !clientCertificateCA.AppendCertsFromPEM(content) { if !clientCertificateCA.AppendCertsFromPEM(content) {

View File

@@ -218,7 +218,7 @@ func NewUTLSClient(ctx context.Context, logger logger.ContextLogger, serverAddre
if len(certificate) > 0 { if len(certificate) > 0 {
certPool := x509.NewCertPool() certPool := x509.NewCertPool()
if !certPool.AppendCertsFromPEM(certificate) { 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 tlsConfig.RootCAs = certPool
} }

View File

@@ -103,7 +103,7 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
for _, hostKey := range options.HostKey { for _, hostKey := range options.HostKey {
key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(hostKey)) key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(hostKey))
if err != nil { 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) outbound.hostKey = append(outbound.hostKey, key)
} }