/// <summary> /// Initializes a new instance of the <see cref="ChainedProxySocket"/> class. /// </summary> /// <param name="chainedProxySocket">Other instance of this class.</param> /// <param name="addressFamily">One of the AddressFamily values.</param> /// <param name="socketType">One of the SocketType values.</param> /// <param name="protocolType">One of the ProtocolType values.</param> /// <param name="proxyUsername">The username to use when authenticating with the proxy server.</param> /// <param name="proxyPassword">The password to use when authenticating with the proxy server.</param> /// <exception cref="SocketException">The combination of addressFamily, socketType, and protocolType results in an invalid socket.</exception> /// <exception cref="ArgumentNullException"><c>proxyUsername</c> -or- <c>proxyPassword</c> is null.</exception> private ChainedProxySocket(ChainedProxySocket chainedProxySocket, AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, string proxyUsername, string proxyPassword) { this.chainedProxySocket = chainedProxySocket; ProxyUser = proxyUsername; ProxyPass = proxyPassword; ToThrow = new InvalidOperationException(); }
public ChainedProxySocket AddChainedProxy(ProxyDatum proxy, AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, string proxyUsername, string proxyPassword) { // Create a new ChainedProxySocket var chainedProxySocket = new ChainedProxySocket(this, addressFamily, socketType, protocolType, proxyUsername, proxyPassword); chainedProxySocket.ProxyDatum = proxy; // Set the proxy settings chainedProxySocket.ProxyEndPoint = new IPEndPoint(IPAddress.Parse(proxy.Ip), proxy.Port); chainedProxySocket.ProxyType = proxy.GetTestedProxyType(addressFamily, socketType, protocolType); return(chainedProxySocket); }
/// <summary> /// Initializes a new instance of the <see cref="ChainedProxySocket"/> class. /// </summary> /// <param name="chainedProxySocket">Other instance of this class.</param> /// <param name="addressFamily">One of the AddressFamily values.</param> /// <param name="socketType">One of the SocketType values.</param> /// <param name="protocolType">One of the ProtocolType values.</param> /// <param name="proxyUsername">The username to use when authenticating with the proxy server.</param> /// <exception cref="SocketException">The combination of addressFamily, socketType, and protocolType results in an invalid socket.</exception> /// <exception cref="ArgumentNullException"><c>proxyUsername</c> is null.</exception> private ChainedProxySocket(ChainedProxySocket chainedProxySocket, AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, string proxyUsername) : this(chainedProxySocket, addressFamily, socketType, protocolType, proxyUsername, "") { }