Skip to content

Commit

Permalink
fix (testdirectory): fix localhost SAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambrt committed Mar 27, 2024
1 parent f5114b0 commit b26c8c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions testdirectory/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,13 @@ func GetTLSConfig(t TestingT, opt ...Option) (s *tls.Config, c *tls.Config) {
opts := getOpts(t, opt...)

var ipAddrs []net.IP
if hostIp := net.ParseIP(opts.withHost); hostIp != nil {
ipAddrs = append(ipAddrs, hostIp)
switch {
case opts.withHost == "localhost":
ipAddrs = append(ipAddrs, net.IPv4(127, 0, 0, 1))
default:
if hostIp := net.ParseIP(opts.withHost); hostIp != nil {
ipAddrs = append(ipAddrs, hostIp)
}
}

cert := &x509.Certificate{
Expand Down

0 comments on commit b26c8c5

Please sign in to comment.