我使用c#并构建了socks5客户端,它使用socks5服务器来获取网页。但这些页面只在80端口(HTTP)上。我想打开443端口(HTTPS)上的页面。例如:https://google.com。如果我只是通过socks5在443上连接 - >谷歌服务器拒绝我。我怎么能这样做?
PS:我的客户端通过套接字工作,也许我应该用另一种方式?
抱歉我的英语。
答案 0 :(得分:0)
非常感谢@jdweng。解决方案是:
我们可以使用TcpClient或Sockets(无关紧要)来连接我们的socks服务器。 e.g:
create TcpClient using our socksIp/socksPort
get NetworkStream from our TcpClient.GetStream();
or use sockets
________
THEN:
________
send 0x05,0x01,0x00
receive 0x05, 0x00
send 0x05, 0x01, 0x00, 0x03, 0x0f, 0x77, 0x77, 0x77, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65 <- it's for www.example.com:443
receive 0x05, 0x00, 0x00, 0x01, etc
if we used sockets -> create NetworkStream from our socket
create SslStream from our NetworkStream
in SslStream - authenticate as client with www.example.com
send our request like a "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: close\r\n\r\n"
receive while not eof
close stream/socket etc
利润:)