Skip to content

Pick an interface based on a target IP #3

Description

@todb-r7

As a user, I would like to be able to communicate to NetworkInterface the IP address I'm trying to reach. You can determine which is the best interface based on the routing table.

The code should look something like:

ipaddr = '127.1.1.1'
NetworkInterface.pick_interface(ipaddr) # => 'lo'
ipaddr = '10.0.0.1'
NetworkInterface.pick_interface(ipaddr) # => 'eth0'
ipaddr = '8.8.8.8'
NetworkInterface.pick_interface(ipaddr) # => 'wlan0'

Something like that.

cc @sho-luv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions