Skip to content

Commit 9c4a2ef

Browse files
committed
增加转换为IWebProxy方法
1 parent aa73912 commit 9c4a2ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

WebApiClient/ProxyInfo.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,17 @@ public string ToHttpTunnelRequestString(Uri targetAddress)
133133
}
134134
return builder.Append(CRLF).ToString();
135135
}
136+
137+
/// <summary>
138+
/// 转换为web代理
139+
/// </summary>
140+
/// <returns></returns>
141+
public IWebProxy ToWebProxy()
142+
{
143+
return new WebProxy(this.Host, this.Port)
144+
{
145+
Credentials = new NetworkCredential(this.UserName, this.Password)
146+
};
147+
}
136148
}
137149
}

0 commit comments

Comments
 (0)