took some code from shadowsocks but it is not working as expected just yet