Skip to content

inaccurate error message when using SSL to connect to RabbitMQ server #56

@douxu

Description

@douxu

Describe the bug

when use github.com/rabbitmq/rabbitmq-amqp-go-client connect RabbitMQ server failed by ssl, the error contains message like this ERROR Failed to open connection amqps://guest@*****192.168.2.104:5671/="dial tcp 192.168.2.104:5671: connect: operation timed out. but when client connect RabbitMQ server,there is no username and password in protocol,just amqps://192.168.2.104:5671. when track the source of error message,
found error message from this func NewConnection in this file github.com/rabbitmq/[email protected]/pkg/rabbitmqamqp/amqp_environment.go.this error message is reported when the Dial func fails to be called in NewConnection func. use this ExtractWithoutPassword func to parse address info when outputing error message. in this ExtractWithoutPassword func,when parses the URI information, a default structure is defined, and the parameters in this structure are continuously assigned and returned.
but there is no separate handling of amqps protocol conditions when ExtractWithoutPassword end. only use return u.Scheme + "://" + u.Username + "@*****" + u.Host + ":" + strconv.Itoa(u.Port) + u.Vhost output uri info by all conditions.

Reproduction steps

  1. use tls-gen generate ssl file
  2. add ssl config into rabbitmq.conf
  3. add client ssl file parse
  4. use amqps protocol to connect server

Expected behavior

expected error message like this ERROR Failed to open connection amqps://192.168.2.104:5671/

Additional context

  1. go version 1.24
  2. rabbitmq-amqp-go-client v0.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions