I have an arm IOT device running Ubuntu server and I need to both read and write the following in GO code
- IP Address (IPV4)
- Subnet Mask
- Default Gateway
- Primary DNS
- Secondary DNS
I know I can set them from the command line using ifconfig, route and nameserver and put these commands in a bash script followed by running /etc/init.d/networking restart to make the change permanent.
I could even write a file handler to edit /etc/network/interfaces directly BUT both of these options seem like a hack so I would much rather do it in pure GO.
Funny thing is that docker is written in GO and the containers have their own ip address so its surely possible unless they are making low level kernel calls.
I have looked in the os and net packages and nothing jumps out and slaps me in the face, so I woud really appreciate any help in this area.