Based on the comments here [1-2], I tried to test the availability of my socks5 proxy, but failed to get the information I needed:
werner@X10DAi:~$ echo 050100 | xxd -p -r | netcat 127.0.0.1 18888
^C
werner@X10DAi:~$ printf "\x05\x01\x00\r\n" | nc 127.0.0.1 18888 | hd
^C
But curl will return useful information as follows:
werner@X10DAi:~$ curl -Ivx socks5h://
127.0.0.1:18888 www.baidu.com
* Trying 127.0.0.1:18888...
* SOCKS5 connect to
www.baidu.com:80 (remotely resolved)
* SOCKS5 request granted.
* Connected to (nil) (127.0.0.1) port 18888 (#0)
> HEAD / HTTP/1.1
> Host:
www.baidu.com
> User-Agent: curl/7.85.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Connection: keep-alive
Connection: keep-alive
< Content-Length: 277
Content-Length: 277
< Content-Type: text/html
Content-Type: text/html
< Date: Sat, 04 Mar 2023 13:24:38 GMT
Date: Sat, 04 Mar 2023 13:24:38 GMT
< Etag: "575e1f6f-115"
Etag: "575e1f6f-115"
< Last-Modified: Mon, 13 Jun 2016 02:50:23 GMT
Last-Modified: Mon, 13 Jun 2016 02:50:23 GMT
< Pragma: no-cache
Pragma: no-cache
< Server: bfe/
1.0.8.18
Server: bfe/
1.0.8.18
<
* Connection #0 to host (nil) left intact
Any tips/comments/explanations for this problem will be appreciated.
[1]
https://superuser.com/questions/303251/how-to-check-if-a-socks5-proxy-works
[2]
https://stackoverflow.com/questions/52530515/how-use-netcat-to-test-socks5-server
Regards,
Zhao