Default shell script or c program to make USB a network device tunnel (eg tun0) w/ NAT

I used to use this software called Azilink to do a Java-based NAT through my android phone to an OpenVPN tun on my computer. How would I make this happen with C or bash?