Implementing a .net proxy client in C#
Creating a proxy to another web api with Asp.net core
Table of Contents
A .NET proxy Client is an interface that lets you connect to a web service with code in .NET format. The .NET proxy can return a requested resource from its cache, or forward the request to a server that has the resource.
ProxyClient for .NET is a proxy client component targeted at the Microsoft .NET platform, which allows to easily establish proxied connections from both new and existing sockets (and TcpClient instances). As of version 2.0, it can also listen for and accept incoming connections established against a remote proxy server, as if they were accepted locally.
Proxy Protocols
代理协议的种类
ProxyClient for .NET supports the following proxy protocols:
SOCKS v4
SOCKS v4a
SOCKS v5
HTTP-CONNECT proxy
HTTPs-CONNECT proxy
Modes
ProcessMode - Use Netfilter driver to intercept process traffic
ShareMode - Share your network based on WinPcap / Npcap
TunMode - Use WinTUN driver to create virtual adapter
WebMode - Web proxy mode
操作系统级代理设置-修改操作系统代理设置
在程序中自动设置代理服务器,不需要用户手动进行设置的方法。实现Windows全局代理服务器的设置
R可修改本地局域网连接的代理设置,使其指向程序在本地主机上监听的端口。
可修改所有系统连接的代理设置,使其指向程序在本地主机上侦听的端口。
可修改系统中与ftp相关联的代理设置,使其指向程序在本地主机上侦听的端口。
可修改当前使用PAC文件配置方式进行网络连接时所使用到的代理设置。
应用程序级代理设置
浏览器代理设置-让用户设置代理服务器
设置IE的代理
git 代理设置
git 支持设置 http 代理和 socks5 代理,http 的代理和 https 的代理是分开设置的
search c# 实现Windows全局代理服务器的设置
search Global Windows Proxy using C# .NET
ProxyClient for .NET offers an easy way to traverse f, using proxy servers, from within your applications; it can quickly make outgoing TCP connections to SOCKS v4, SOCKS v4A, SOCKS v5 and HTTP-CONNECT proxy servers
// Set up a new proxy client object, bound to a SOCKS 5 server
var proxy = new Socks5Client(IPAddress.Parse("10.0.1.2"),
"john",
"$ecrEt");
// The target endpoint will be one of the Google's webservers
var googleAddress = Dns.GetHostEntry("www.google.com").AddressList[0];
var targetEndPoint = new IPEndPoint(googleAddress, 80);
// Connect to a target IP endpoint via HTTP through a proxied connection
var proxiedConnection = proxyClient.Connect(targetEndPoint);
using (var proxiedStream = new NetworkStream(proxiedConnection.Socket))
using (var writer = new StreamWriter(proxiedStream, Encoding.ASCII))
{
// Send the HTTP request to www.google.com
writer.WriteLine("GET / HTTP/1.1");
writer.WriteLine();
writer.Flush();
// ...
}
source:https://cobisi.com/proxy-client/.net-component