var handler = new HttpClientHandler()
{
Proxy = new WebProxy("192.168.0.103", 1082),
UseProxy = true
};
var client = new HttpClient(handler);
这是普通的代理,如果我要使用vless+ws+tls,该怎么改
var handler = new HttpClientHandler()
{
Proxy = new WebProxy("192.168.0.103", 1082),
UseProxy = true
};
var client = new HttpClient(handler);
这是普通的代理,如果我要使用vless+ws+tls,该怎么改
代码给了,希望采纳
using System;
using System.Net;
using System.Net.Http;
namespace TestHttpClient
{
class Program
{
static void Main(string[] args)
{
// vless + ws + tls 连接参数
string host = "yourdomain.com"; // 填写你的域名或者IP地址
int port = 443; // 默认端口
string path = "/path/your-path"; // 填写你的WebSocket Path
// 创建HttpClient实例并设置代理
HttpClientHandler handler = new HttpClientHandler();
handler.UseProxy = true;
handler.Proxy = new WebProxy("http://127.0.0.1:10809");
// 创建HttpClient实例并设置代理处理程序
HttpClient client = new HttpClient(handler);
// 使用vless + ws + tls协议访问网站
client.BaseAddress = new Uri($"https://{host}:{port}{path}");
// 发送一个HTTP请求
HttpResponseMessage response = client.GetAsync("/").Result;
// 打印服务器响应内容
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
}
}