Closed xor-gate closed 2 weeks ago
Could a test be added for this?
I added a first test to call the new SetListenPort
function and test if the Addr
returns it. An extra test is needed to check what happens when the static port is already in use. Currently the server.ListenAndServe
on s.port
is scheduled in the background with any feedback. Also it is currently not possible to gracefull stop the server. But then this PR would probably be a lot bigger change. Let met know what you think. Probably the best thing to do is check if the ListenAndServe returns and write in a channel the failure. Then set s.port
back to zero. But i'm dusting off my Golang skills.
Also the used unittest framework is a little complex at first sight. I was used to the more simple github.com/stretchr/testify
.
Thanks!
Currently the proxy dynamicly uses a listen port for the SOCKS5 channel. This PR adds functionality to set a static listen port which is needed in certain scenarios. It is a method addition and doesn't break the existing API.