-
Describe the bugThanks for this great project. When using // main.go
conn, err := amqp.Dial("amqp://goadmin:123456@localhost:5672/goapp-vhost")
connState := conn.ConnectionState()
fmt.Println("Server name: ", connState.ServerName)
fmt.Println("Version: ", connState.Version) $ go run main.go
0 Reproduction steps
Expected behaviorprint right server name and version. Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is working as intended. You are not dialing to an By setting a RabbitMQ server that serves over AMQP+TLS, and running this code: // main.go
conn, err := amqp.DialTLS("amqps://127.0.0.1:5671", &tls.Config{
InsecureSkipVerify: true,
})
if err != nil {
errLog.Fatalf("error dialing: %s", err)
}
defer conn.Close()
connState := conn.ConnectionState()
infoLog.Printf("Server name: '%s'", connState.ServerName)
infoLog.Printf("Version: %#x", connState.Version)
// Output
// 2023/07/12 12:58:46 [INFO] Server name: ''
// 2023/07/12 12:58:46 [INFO] Version: 0x304 I get the expected results. Note that server name is still empty, because I dialed to an IP address. The number 0x0304 matches the constant for TLS 1.3 |
Beta Was this translation helpful? Give feedback.
-
Thanks for your working |
Beta Was this translation helpful? Give feedback.
This is working as intended. You are not dialing to an
amqps
address, therefore,Dial
is not starting a TLS transport. Since it is not using TLS,ConnectionState
returns a zero-value, as documented in the function documentation. See also tls#ConnectionState for the fields you can find and their meaning.By setting a RabbitMQ server that serves over AMQP+TLS, and running this code: