here is an example of this except its in python https://github.com/meshtastic/python/blob/master/meshtastic/tunnel.py