Reconstruct all the codes, including server, client and certManager part.
Seperate main.c into multi files.