I have a server that exposes its services over rpc and a client that uses these services. To test this setup, I need to introduce packet losses and delays. I found a few techniques on stackoverflow like tc, modifying iptables etc but all of them need root password to simulate the packet loss. Is there a way to simulate these packet losses without needing a root password.
Note: The code is written in GO programming language
One way is to isolate your packet handling code, and create mock-version of it (or ifdef'd sections) that, for testing, misbehave in the manner of your choosing.
That may be enough for your needs.
For industrial-strength testing, for a commercial or critical application, you'll want AT LEAST a box where you have root password. :) And perhaps more exotic test equipment that can misbehave in more exotic ways.