Skip to content

Commit

Permalink
fix parsing url for core ip
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Jun 3, 2023
1 parent 504ff93 commit 795cec9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nodebuilder/core/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package core
import (
"fmt"
"net"
"net/url"

"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
Expand Down Expand Up @@ -50,7 +51,11 @@ func ParseFlags(cmd *cobra.Command, cfg *Config) error {

ip := net.ParseIP(coreIP)
if ip == nil {
ips, err := net.LookupIP(coreIP)
u, err := url.Parse(coreIP)
if err != nil {
return fmt.Errorf("failed to parse url: %w", err)
}
ips, err := net.LookupIP(u.Host)
if err != nil {
return fmt.Errorf("failed to resolve DNS record: %v", err)
}
Expand Down

0 comments on commit 795cec9

Please sign in to comment.