Skip to content

Commit

Permalink
fix (testdirectory): fix localhost SAN (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambrt authored Mar 27, 2024
1 parent f5114b0 commit 213472b
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 213472b

Please sign in to comment.