Fixed port not being added to probing request

This commit is contained in:
David Allen 2024-08-09 17:51:23 -06:00
parent 7beb7a33fc
commit bc01412b08
Signed by: towk
GPG key ID: 793B2924A49B3A3F

View file

@ -57,7 +57,7 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
) )
if params.Verbose { if params.Verbose {
log.Info().Msg("starting scan...") log.Info().Any("args", params).Msg("starting scan...")
} }
var wg sync.WaitGroup var wg sync.WaitGroup
@ -83,7 +83,7 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
if !params.DisableProbing { if !params.DisableProbing {
assetsToAdd := []RemoteAsset{} assetsToAdd := []RemoteAsset{}
for _, foundAsset := range foundAssets { for _, foundAsset := range foundAssets {
url := fmt.Sprintf("%s://%s/redfish/v1/", params.Scheme, foundAsset.Host) url := fmt.Sprintf("%s://%s:%d/redfish/v1/", params.Scheme, foundAsset.Host, foundAsset.Port)
res, _, err := util.MakeRequest(nil, url, http.MethodGet, nil, nil) res, _, err := util.MakeRequest(nil, url, http.MethodGet, nil, nil)
if err != nil || res == nil { if err != nil || res == nil {
if params.Verbose { if params.Verbose {
@ -202,7 +202,7 @@ func rawConnect(address string, protocol string, timeoutSeconds int, keepOpenOnl
) )
// try to conntect to host (expects host in format [10.0.0.0]:443) // try to conntect to host (expects host in format [10.0.0.0]:443)
target := fmt.Sprintf("[%s]:%s", uri.Hostname(), uri.Port()) target := fmt.Sprintf("%s:%s", uri.Hostname(), uri.Port())
conn, err := net.DialTimeout(protocol, target, timeoutDuration) conn, err := net.DialTimeout(protocol, target, timeoutDuration)
if err != nil { if err != nil {
asset.State = false asset.State = false