Best practices - Writing code to run on wired or wireless networking hardware?

I have a library I wrote that is working great over wired ethernet. I’m using the Ethernet library, and I’m using objects like ‘Ethernet’, ‘EthernetClient’, ‘EthernetServer’, etc.

I just got another board with built-in wireless, based on the ESP8266 hardware. The samples there have object types like ‘WiFiClient’, etc etc etc.

So, what’s the best way of writing code that can work in either environment? Is there a ‘unified’ networking library that will hide as many of these differences as possible from my code?

I haven’t dug deep enough to know yet if the two sets of classes provide a similar code interface once things have been initialized. Are things similar enough that judicious use of #IFDEF and typedefs will abstract the differences away?

I know that things like initialization etc have to be different, but that can all be handled by the host sketch, whatever code is using my library.

Do most people just not worry about it, write to one interface, and call it a day?