summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgconn/config.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-03-06 10:12:45 +0100
committerLibravatar GitHub <noreply@github.com>2023-03-06 10:12:45 +0100
commit24f6a447f3533f34a61237594d4b9b20d5a9fb78 (patch)
tree29b54a80c73b806b34b8e069b5b76f230f039814 /vendor/github.com/jackc/pgconn/config.go
parent[chore]: Bump golang.org/x/oauth2 from 0.5.0 to 0.6.0 (#1597) (diff)
downloadgotosocial-24f6a447f3533f34a61237594d4b9b20d5a9fb78.tar.xz
[chore]: Bump github.com/jackc/pgx/v4 from 4.17.2 to 4.18.1 (#1595)
Bumps [github.com/jackc/pgx/v4](https://github.com/jackc/pgx) from 4.17.2 to 4.18.1. - [Release notes](https://github.com/jackc/pgx/releases) - [Changelog](https://github.com/jackc/pgx/blob/v4.18.1/CHANGELOG.md) - [Commits](https://github.com/jackc/pgx/compare/v4.17.2...v4.18.1) --- updated-dependencies: - dependency-name: github.com/jackc/pgx/v4 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/jackc/pgconn/config.go')
-rw-r--r--vendor/github.com/jackc/pgconn/config.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/github.com/jackc/pgconn/config.go b/vendor/github.com/jackc/pgconn/config.go
index 2277dc1de..4080f2c6a 100644
--- a/vendor/github.com/jackc/pgconn/config.go
+++ b/vendor/github.com/jackc/pgconn/config.go
@@ -297,6 +297,7 @@ func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*Con
"sslcert": {},
"sslrootcert": {},
"sslpassword": {},
+ "sslsni": {},
"krbspn": {},
"krbsrvname": {},
"target_session_attrs": {},
@@ -424,6 +425,7 @@ func parseEnvSettings() map[string]string {
"PGSSLMODE": "sslmode",
"PGSSLKEY": "sslkey",
"PGSSLCERT": "sslcert",
+ "PGSSLSNI": "sslsni",
"PGSSLROOTCERT": "sslrootcert",
"PGSSLPASSWORD": "sslpassword",
"PGTARGETSESSIONATTRS": "target_session_attrs",
@@ -619,11 +621,15 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P
sslcert := settings["sslcert"]
sslkey := settings["sslkey"]
sslpassword := settings["sslpassword"]
+ sslsni := settings["sslsni"]
// Match libpq default behavior
if sslmode == "" {
sslmode = "prefer"
}
+ if sslsni == "" {
+ sslsni = "1"
+ }
tlsConfig := &tls.Config{}
@@ -756,6 +762,13 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P
tlsConfig.Certificates = []tls.Certificate{cert}
}
+ // Set Server Name Indication (SNI), if enabled by connection parameters.
+ // Per RFC 6066, do not set it if the host is a literal IP address (IPv4
+ // or IPv6).
+ if sslsni == "1" && net.ParseIP(host) == nil {
+ tlsConfig.ServerName = host
+ }
+
switch sslmode {
case "allow":
return []*tls.Config{nil, tlsConfig}, nil