Moved the network functions from the DHT into network.

Also made a nice function to init networking.