Active network service

My script needs to know what network service is currently used for internet connection. I have two network services enabled so this code do not help:

do shell script "networksetup -listallnetworkservices"


use ifconfig. If this line

do shell script "/sbin/ifconfig en0 | /usr/bin/awk '/inet / {print $2}'"

returns an IP Address, it’s Ethernet, if it does checking with en1, it’s Airport