bigeagle / gohop

A VPN implemention in golang, with crypto and obfuscation in nature.
1.33k stars 195 forks source link

Unable to handshake with the server #27

Open ghost opened 5 years ago

ghost commented 5 years ago

I wanted to connect from my minnowboard running Ubuntu18.04 to my VPS deployed in HK with gohop. But the handshaking could not be done after both server and client have been correctly configured according to the manual. After diagnosing with several potential causes, i finally found that the ports in the range specified in the server.ini are listened by the server only for udp6 addresses as my ISP does not really support ipv6 addressing. Even if I disabled the ipv6 on the server side, the ports are still listened only for udp6. This may be the cause of the problem. Here is the netstat output: udp6 0 0 [::]:40100 [::]:* udp6 0 0 [::]:40101 [::]:* udp6 0 0 [::]:40102 [::]:* udp6 0 0 [::]:40103 [::]:* udp6 0 0 [::]:40104 [::]:* udp6 0 0 [::]:40105 [::]:* udp6 0 0 [::]:40106 [::]:* udp6 0 0 [::]:40107 [::]:* udp6 0 0 [::]:40108 [::]:* udp6 0 0 [::]:40109 [::]:* udp6 0 0 [::]:40110 [::]:* udp6 0 0 [::]:40111 [::]:* udp6 0 0 [::]:40112 [::]:* udp6 0 0 [::]:40113 [::]:* udp6 0 0 [::]:40114 [::]:* udp6 0 0 [::]:40115 [::]:* udp6 0 0 [::]:40116 [::]:* udp6 0 0 [::]:40117 [::]:* udp6 0 0 [::]:40118 [::]:* udp6 0 0 [::]:40119 [::]:* udp6 0 0 [::]:40120 [::]:* udp6 0 0 [::]:40121 [::]:* udp6 0 0 [::]:40122 [::]:* udp6 0 0 [::]:40123 [::]:* udp6 0 0 [::]:40124 [::]:* udp6 0 0 [::]:40125 [::]:* udp6 0 0 [::]:40126 [::]:* udp6 0 0 [::]:40127 [::]:* udp6 0 0 [::]:40128 [::]:* udp6 0 0 [::]:40129 [::]:* udp6 0 0 [::]:40130 [::]:* udp6 0 0 [::]:40131 [::]:* udp6 0 0 [::]:40132 [::]:* udp6 0 0 [::]:40133 [::]:* udp6 0 0 [::]:40134 [::]:* udp6 0 0 [::]:40135 [::]:* udp6 0 0 [::]:40136 [::]:* udp6 0 0 [::]:40137 [::]:* udp6 0 0 [::]:40138 [::]:* udp6 0 0 [::]:40139 [::]:* udp6 0 0 [::]:40140 [::]:* udp6 0 0 [::]:40141 [::]:* udp6 0 0 [::]:40142 [::]:* udp6 0 0 [::]:40143 [::]:* udp6 0 0 [::]:40144 [::]:* udp6 0 0 [::]:40145 [::]:* udp6 0 0 [::]:40146 [::]:* udp6 0 0 [::]:40147 [::]:* udp6 0 0 [::]:40148 [::]:* udp6 0 0 [::]:40149 [::]:* udp6 0 0 [::]:40150 [::]:* udp6 0 0 [::]:40151 [::]:* udp6 0 0 [::]:40152 [::]:* udp6 0 0 [::]:40153 [::]:* udp6 0 0 [::]:40154 [::]:* udp6 0 0 [::]:40155 [::]:* udp6 0 0 [::]:40156 [::]:* udp6 0 0 [::]:40157 [::]:* udp6 0 0 [::]:40158 [::]:* udp6 0 0 [::]:40159 [::]:* udp6 0 0 [::]:40160 [::]:* udp6 0 0 [::]:40161 [::]:* udp6 0 0 [::]:40162 [::]:* udp6 0 0 [::]:40163 [::]:* udp6 0 0 [::]:40164 [::]:* udp6 0 0 [::]:40165 [::]:* udp6 0 0 [::]:40166 [::]:* udp6 0 0 [::]:40167 [::]:* udp6 0 0 [::]:40168 [::]:* udp6 0 0 [::]:40169 [::]:* udp6 0 0 [::]:40170 [::]:* udp6 0 0 [::]:40171 [::]:* udp6 0 0 [::]:40172 [::]:* udp6 0 0 [::]:40173 [::]:* udp6 0 0 [::]:40174 [::]:* udp6 0 0 [::]:40175 [::]:* udp6 0 0 [::]:40176 [::]:* udp6 0 0 [::]:40177 [::]:* udp6 0 0 [::]:40178 [::]:* udp6 0 0 [::]:40179 [::]:* udp6 0 0 [::]:40180 [::]:* udp6 0 0 [::]:40181 [::]:* udp6 0 0 [::]:40182 [::]:* udp6 0 0 [::]:40183 [::]:* udp6 0 0 [::]:40184 [::]:* udp6 0 0 [::]:40185 [::]:* udp6 0 0 [::]:40186 [::]:* udp6 0 0 [::]:40187 [::]:* udp6 0 0 [::]:40188 [::]:* udp6 0 0 [::]:40189 [::]:* udp6 0 0 [::]:40190 [::]:* udp6 0 0 [::]:40191 [::]:* udp6 0 0 [::]:40192 [::]:* udp6 0 0 [::]:40193 [::]:* udp6 0 0 [::]:40194 [::]:* udp6 0 0 [::]:40195 [::]:* udp6 0 0 [::]:40196 [::]:* udp6 0 0 [::]:40197 [::]:* udp6 0 0 [::]:40198 [::]:* udp6 0 0 [::]:40199 [::]:* udp6 0 0 [::]:40200 [::]:*

ghost commented 5 years ago

It may be a potential bug that errors occur when the range of ports to listen on the server side is too large. You may fix this by adding a limitation on the port range.

when my config looks like this:

port range to listen hopstart = 40000 hopend = 50000

error output

server side:

2018/11/25 00:39:52 server.go:175: ERROR: Failed to listen udp port :45503: listen udp :45503: too many open files 2018/11/25 00:39:52 server.go:175: ERROR: Failed to listen udp port :45503: listen udp :45503: too many open files 2018/11/25 00:39:52 server.go:175: ERROR: Failed to listen udp port :45504: listen udp :45504: too many open files 2018/11/25 00:39:52 server.go:175: ERROR: Failed to listen udp port :45504: listen udp :45504: too many open files 2018/11/25 00:39:52 server.go:175: ERROR: Failed to listen udp port :45505: listen udp :45505: too many open files x N

client side:

`goroutine 11954 [runnable]: github.com/bigeagle/gohop/hop.func·007() /home/bigeagle/workspace/golang/src/github.com/bigeagle/gohop/hop/client.go:241 created by github.com/bigeagle/gohop/hop.(*HopClient).handleUDP /home/bigeagle/workspace/golang/src/github.com/bigeagle/gohop/hop/client.go:251 +0x5ad

goroutine 11955 [runnable]: github.com/bigeagle/gohop/hop.func·006() /home/bigeagle/workspace/golang/src/github.com/bigeagle/gohop/hop/client.go:220` x N

ghost commented 5 years ago

@bigeagle