Skip to content

Improve URL suggestion by checking against default gateway #12

@philippgille

Description

@philippgille

Instead of relying on network interface names we could check the IPv4 addresses against the default gateway's address.

For example:

  • The gateway's address is 123.123.123.0
  • Our system, in this example Windows, has (interface name + address):
    • "Ethernet 2": 234.234.234.234
    • "Ethernet 3": 123.123.123.123

If we would choose by name, "Ethernet 2" would match first and we would use that IP address in the URL suggestion, which is the wrong one.

If instead we would match the first three parts of the IP address against the first three parts of the gateway address, we would choose "Ethernet 3", which is the correct one.

This requires determining the gateway's IP address, which is not possible with Go's stdlib. But this package seems to be perfect: https://github.com/jackpal/gateway

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions