Only use bracket format on ipv6 manual peers
Previously the actix http library handled brackets around ipv4
addresses, the latest version no longer handles this transparently and
we now have to check our address formatting depending on if we have an
ipv4 or v6 address to send a http hello to.
@@ -26,11 +26,20 @@ pub struct Hello {
pub async fn handle_hello(msg: Hello) {
trace!("Sending Hello {:?}", msg);
- let endpoint = format!(
+ // ipv6 addresses need the [] bracket format, ipv4 address literals do not
+ let endpoint = if msg.to.contact_socket.is_ipv4() {
+ format!(
+ "http://{}:{}/hello",
+ msg.to.contact_socket.ip(),
+ msg.to.contact_socket.port()
+ )
+ } else {
+ format!(
"http://[{}]:{}/hello",
msg.to.contact_socket.ip(),
msg.to.contact_socket.port()
- );
+ )
+ };
let client = awc::Client::default();
info!("Sending hello request to manual peer: {}", endpoint);
