Skip to content

elastic.v7's sniffing does not support ipv6 address #1456

@ds-lkua

Description

@ds-lkua

Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[x] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

sniff support ipv6 config

Please describe the actual behavior

codes below from "github.com/olivere/elastic/v7/client.go" used by sniffNode does not support ipv6 address(elastic.v6 support)

// extractHostname returns the URL from the http.publish_address setting.
func (c *Client) extractHostname(scheme, address string) string {
          var (
                  host string
                  port string

                  addrs = strings.Split(address, "/")
                  ports = strings.Split(address, ":")
          )

          if len(addrs) > 1 {
                  host = addrs[0]
          } else {
                  host = strings.Split(addrs[0], ":")[0]
          }
          port = ports[len(ports)-1]

          return fmt.Sprintf("%s://%s:%s", scheme, host, port)
 }

Any steps to reproduce the behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions