#48: Add local address information

This commit is contained in:
mhhcbon
2022-03-21 14:54:05 +01:00
committed by Huin
parent ca81a64b42
commit e739c716b4
3 changed files with 33 additions and 1 deletions

View File

@ -143,9 +143,16 @@ func (httpu *HTTPUClient) Do(
continue
}
// Set the related local address used to discover the device.
if a, ok := httpu.conn.LocalAddr().(*net.UDPAddr); ok {
response.Header.Add(LocalAddressHeader, a.IP.String())
}
responses = append(responses, response)
}
// Timeout reached - return discovered responses.
return responses, nil
}
const LocalAddressHeader = "goupnp-local-address"