Skip to content

Commit 1f5eff9

Browse files
committed
host: include address family in sockaddr JSON responses
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent eb99f20 commit 1f5eff9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

host/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,12 @@ fn parse_sockaddr(args: &serde_json::Value) -> Result<SocketAddr> {
874874
}
875875

876876
fn sockaddr_to_json(addr: SocketAddr) -> serde_json::Value {
877+
let family: i32 = match addr {
878+
SocketAddr::V4(_) => 2,
879+
SocketAddr::V6(_) => 10,
880+
};
877881
serde_json::json!({
882+
"family": family,
878883
"addr": addr.ip().to_string(),
879884
"port": addr.port(),
880885
})

0 commit comments

Comments
 (0)