Repository navigation
Conversation
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the DSN is assembled from
database.host/ARTEX_PG_HOST, the host and port were joined ashost + ":" + port. A bare IPv6 address such as::1or2001:db8::5gavepostgres://u@::1:5432/db, which does not parse as a URL, so ARTEX could not connect to a PostgreSQL server on an IPv6 address. Only a host typed as[::1]worked.Behavior change
The authority is built with
net.JoinHostPort, after removing any brackets the operator typed. Hostnames and IPv4 addresses produce the same DSN as before. An explicitARTEX_PG_DSNis still returned unchanged.Tested
config/dsn_host_test.gobuilds a DSN for an empty host, a hostname, IPv4, bare IPv6 and bracketed IPv6, parses it with pgx (pgconn.ParseConfig) and checks the host and port pgx reads (before the change pgx read host::1:5432for::1). The bare IPv6 cases fail before the change.go test ./config,gofmtandgo vetpass.