@@ -131,32 +131,6 @@ private void SetCredentialsByInterface(ICredentials value)
131131 this . credentials = value ;
132132 }
133133
134- /// <summary>
135- /// 从IWebProxy实例转换获得
136- /// </summary>
137- /// <param name="webProxy">IWebProxy</param>
138- /// <param name="targetAddress">目标url地址</param>
139- /// <exception cref="ArgumentNullException"></exception>
140- /// <returns></returns>
141- public static HttpProxy FromWebProxy ( IWebProxy webProxy , Uri targetAddress )
142- {
143- if ( webProxy == null )
144- {
145- throw new ArgumentNullException ( nameof ( webProxy ) ) ;
146- }
147-
148- if ( targetAddress == null )
149- {
150- throw new ArgumentNullException ( nameof ( targetAddress ) ) ;
151- }
152-
153- var proxyAddress = webProxy . GetProxy ( targetAddress ) ;
154- var httpProxy = new HttpProxy ( proxyAddress ) ;
155- httpProxy . SetCredentialsByInterface ( webProxy . Credentials ) ;
156-
157- return httpProxy ;
158- }
159-
160134 /// <summary>
161135 /// 转换Http Tunnel请求字符串
162136 /// </summary>
@@ -217,6 +191,42 @@ public override string ToString()
217191 return $ "http://{ this . Host } :{ this . Port } /";
218192 }
219193
194+ /// <summary>
195+ /// 转换为代理验证器
196+ /// </summary>
197+ /// <returns></returns>
198+ public ProxyValidator ToValidator ( )
199+ {
200+ return new ProxyValidator ( this ) ;
201+ }
202+
203+ /// <summary>
204+ /// 从IWebProxy实例转换获得
205+ /// </summary>
206+ /// <param name="webProxy">IWebProxy</param>
207+ /// <param name="targetAddress">目标url地址</param>
208+ /// <exception cref="ArgumentNullException"></exception>
209+ /// <returns></returns>
210+ public static HttpProxy FromWebProxy ( IWebProxy webProxy , Uri targetAddress )
211+ {
212+ if ( webProxy == null )
213+ {
214+ throw new ArgumentNullException ( nameof ( webProxy ) ) ;
215+ }
216+
217+ if ( targetAddress == null )
218+ {
219+ throw new ArgumentNullException ( nameof ( targetAddress ) ) ;
220+ }
221+
222+ var proxyAddress = webProxy . GetProxy ( targetAddress ) ;
223+ var httpProxy = new HttpProxy ( proxyAddress ) ;
224+ httpProxy . SetCredentialsByInterface ( webProxy . Credentials ) ;
225+
226+ return httpProxy ;
227+ }
228+
229+
220230 /// <summary>
221231 /// 指定ip范围构建http代理服务
222232 /// </summary>
0 commit comments