Skip to content

Conversation

@silvanocerza
Copy link
Contributor

This PR changes the label field of all events returned by mdns-discovery.

Previously it would use the event's name received from the library used internally, now it uses the hostname to build a more readable one.

Previous output:

{
  "eventType": "add",
  "port": {
    "address": "10.130.22.94",
    "label": "Waltz._companion-link._tcp.local. at 10.130.22.94",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "waltz.local.",
      "port": "49949",
      "rpAD": "7cb09634a8a9",
      "rpBA": "AA:DE:47:C4:E5:98",
      "rpFl": "0x20000",
      "rpHA": "5f3e38f43228",
      "rpHI": "94bd919e64ea",
      "rpHN": "4f7e4d9fc3f5",
      "rpMac": "0",
      "rpVr": "330.5"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.107",
    "label": "Alberto\\226\\128\\153s\\ MacBook\\ Pro._companion-link._tcp.local. at 10.130.22.107",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "Albertos-MacBook-Pro.local.",
      "port": "56523",
      "rpAD": "27e04ce2a824",
      "rpBA": "2E:87:10:65:A3:8E",
      "rpFl": "0x20000",
      "rpHA": "91287b2002f8",
      "rpHI": "a4f728bc23e5",
      "rpHN": "7f38009a0a5c",
      "rpVr": "195.2"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.97",
    "label": "48:35:2b:b0:fd:00\\@fe80::4a35:2bff:feb0:fd00._apple-mobdev2._tcp.local. at 10.130.22.97",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "Daedalus-2.local.",
      "port": "32498"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.110",
    "label": "V\\.Rubino\\ MacBook\\ Pro._companion-link._tcp.local. at 10.130.22.110",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "VRubino-MacBook-Pro.local.",
      "port": "49182",
      "rpAD": "8d69c0272eac",
      "rpBA": "DE:BF:8E:A9:A6:66",
      "rpFl": "0x20000",
      "rpHA": "7a8a1ccbe370",
      "rpHI": "d086e991e5fb",
      "rpHN": "b0279f940ebf",
      "rpMac": "0",
      "rpVr": "260.3"
    }
  }
}

New output:

{
  "eventType": "add",
  "port": {
    "address": "10.130.22.94",
    "label": "waltz at 10.130.22.94",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "waltz.local.",
      "port": "49949",
      "rpAD": "7cb09634a8a9",
      "rpBA": "AA:DE:47:C4:E5:98",
      "rpFl": "0x20000",
      "rpHA": "5f3e38f43228",
      "rpHI": "94bd919e64ea",
      "rpHN": "4f7e4d9fc3f5",
      "rpMac": "0",
      "rpVr": "330.5"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.107",
    "label": "Albertos-MacBook-Pro at 10.130.22.107",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "Albertos-MacBook-Pro.local.",
      "port": "56523",
      "rpAD": "27e04ce2a824",
      "rpBA": "2E:87:10:65:A3:8E",
      "rpFl": "0x20000",
      "rpHA": "91287b2002f8",
      "rpHI": "a4f728bc23e5",
      "rpHN": "7f38009a0a5c",
      "rpVr": "195.2"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.97",
    "label": "Daedalus-2 at 10.130.22.97",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "Daedalus-2.local.",
      "port": "32498"
    }
  }
}
{
  "eventType": "add",
  "port": {
    "address": "10.130.22.110",
    "label": "VRubino-MacBook-Pro at 10.130.22.110",
    "protocol": "network",
    "protocolLabel": "Network Port",
    "properties": {
      "hostname": "VRubino-MacBook-Pro.local.",
      "port": "49182",
      "rpAD": "8d69c0272eac",
      "rpBA": "DE:BF:8E:A9:A6:66",
      "rpFl": "0x20000",
      "rpHA": "7a8a1ccbe370",
      "rpHI": "d086e991e5fb",
      "rpHN": "b0279f940ebf",
      "rpMac": "0",
      "rpVr": "260.3"
    }
  }
}

@silvanocerza silvanocerza added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Feb 1, 2022
@silvanocerza silvanocerza requested a review from cmaglie February 1, 2022 09:35
@silvanocerza silvanocerza self-assigned this Feb 1, 2022
@silvanocerza silvanocerza merged commit c809249 into main Feb 1, 2022
@silvanocerza silvanocerza deleted the scerza/better-name branch February 1, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: code Related to content of the project itself type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants