本文整理汇总了C#中ProxyTypes类的典型用法代码示例。如果您正苦于以下问题:C# ProxyTypes类的具体用法?C# ProxyTypes怎么用?C# ProxyTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProxyTypes类属于命名空间,在下文中一共展示了ProxyTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
///
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="IPEndPoint.MinPort"/> and <see cref="IPEndPoint.MaxPort"/>.</exception>
///
/// <exception cref="ArgumentException"><paramref name="username"/> is null or empty.</exception>
protected ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: this()
{
if (!host.IsValidHost())
throw new ArgumentException("host");
if (!string.IsNullOrEmpty(proxyHost) && !proxyHost.IsValidHost())
throw new ArgumentException("proxyHost");
if (!port.IsValidPort())
throw new ArgumentOutOfRangeException("port");
if (!proxyPort.IsValidPort())
throw new ArgumentOutOfRangeException("proxyPort");
if (username.IsNullOrWhiteSpace())
throw new ArgumentException("username");
this.Host = host;
this.Port = port;
this.Username = username;
this.ProxyType = proxyType;
this.ProxyHost = proxyHost;
this.ProxyPort = proxyPort;
this.ProxyUsername = proxyUsername;
this.ProxyPassword = proxyPassword;
}
示例2: PasswordConnectionInfoConstructorTest10
public void PasswordConnectionInfoConstructorTest10()
{
string host = string.Empty; // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
string password = string.Empty; // TODO: Initialize to an appropriate value
ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
int proxyPort = 0; // TODO: Initialize to an appropriate value
PasswordConnectionInfo target = new PasswordConnectionInfo(host, username, password, proxyType, proxyHost, proxyPort);
Assert.Inconclusive("TODO: Implement code to verify target");
}
示例3: KeyboardInteractiveConnectionInfoConstructorTest2
public void KeyboardInteractiveConnectionInfoConstructorTest2()
{
string host = string.Empty; // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
int proxyPort = 0; // TODO: Initialize to an appropriate value
string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
KeyboardInteractiveConnectionInfo target = new KeyboardInteractiveConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername);
Assert.Inconclusive("TODO: Implement code to verify target");
}
示例4: ConnectionInfoConstructorTest
public void ConnectionInfoConstructorTest()
{
string host = string.Empty; // TODO: Initialize to an appropriate value
int port = 0; // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
int proxyPort = 0; // TODO: Initialize to an appropriate value
string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
AuthenticationMethod[] authenticationMethods = null; // TODO: Initialize to an appropriate value
ConnectionInfo target = new ConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, authenticationMethods);
Assert.Inconclusive("TODO: Implement code to verify target");
}
示例5: PasswordConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">The port.</param>
/// <param name="username">Connection username.</param>
/// <param name="password">Connection password.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(username, password))
{
foreach (var authenticationMethod in AuthenticationMethods.OfType<PasswordAuthenticationMethod>())
{
authenticationMethod.PasswordExpired += AuthenticationMethod_PasswordExpired;
}
}
示例6: ConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
/// <param name="authenticationMethods">The authentication methods.</param>
/// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException"><paramref name="username" /> is null, a zero-length string or contains only whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
/// <exception cref="ArgumentNullException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyHost" /> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyPort" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
/// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
{
if (host == null)
throw new ArgumentNullException("host");
port.ValidatePort("port");
if (username == null)
throw new ArgumentNullException("username");
if (username.All(char.IsWhiteSpace))
throw new ArgumentException("Cannot be empty or contain only whitespace.", "username");
if (proxyType != ProxyTypes.None)
{
if (proxyHost == null)
throw new ArgumentNullException("proxyHost");
proxyPort.ValidatePort("proxyPort");
}
if (authenticationMethods == null)
throw new ArgumentNullException("authenticationMethods");
if (authenticationMethods.Length == 0)
throw new ArgumentException("At least one authentication method should be specified.", "authenticationMethods");
// Set default connection values
Timeout = TimeSpan.FromSeconds(30);
RetryAttempts = 10;
MaxSessions = 10;
Encoding = Encoding.UTF8;
KeyExchangeAlgorithms = new Dictionary<string, Type>
{
{"diffie-hellman-group-exchange-sha256", typeof (KeyExchangeDiffieHellmanGroupExchangeSha256)},
{"diffie-hellman-group-exchange-sha1", typeof (KeyExchangeDiffieHellmanGroupExchangeSha1)},
{"diffie-hellman-group14-sha1", typeof (KeyExchangeDiffieHellmanGroup14Sha1)},
{"diffie-hellman-group1-sha1", typeof (KeyExchangeDiffieHellmanGroup1Sha1)},
//{"ecdh-sha2-nistp256", typeof(KeyExchangeEllipticCurveDiffieHellman)},
//{"ecdh-sha2-nistp256", typeof(...)},
//{"ecdh-sha2-nistp384", typeof(...)},
//{"ecdh-sha2-nistp521", typeof(...)},
//"gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==" - WinSSHD
//"gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==" - WinSSHD
};
Encryptions = new Dictionary<string, CipherInfo>
{
{"aes256-ctr", new CipherInfo(256, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
{"3des-cbc", new CipherInfo(192, (key, iv) => new TripleDesCipher(key, new CbcCipherMode(iv), null))},
{"aes128-cbc", new CipherInfo(128, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
{"aes192-cbc", new CipherInfo(192, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
{"aes256-cbc", new CipherInfo(256, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
{"blowfish-cbc", new CipherInfo(128, (key, iv) => new BlowfishCipher(key, new CbcCipherMode(iv), null))},
{"twofish-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
{"twofish192-cbc", new CipherInfo(192, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
{"twofish128-cbc", new CipherInfo(128, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
{"twofish256-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
////{"serpent256-cbc", typeof(CipherSerpent256CBC)},
////{"serpent192-cbc", typeof(...)},
////{"serpent128-cbc", typeof(...)},
{"arcfour", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, false))},
{"arcfour128", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, true))},
{"arcfour256", new CipherInfo(256, (key, iv) => new Arc4Cipher(key, true))},
////{"idea-cbc", typeof(...)},
{"cast128-cbc", new CipherInfo(128, (key, iv) => new CastCipher(key, new CbcCipherMode(iv), null))},
////{"[email protected]", typeof(...)},
{"aes128-ctr", new CipherInfo(128, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
{"aes192-ctr", new CipherInfo(192, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
};
HmacAlgorithms = new Dictionary<string, HashInfo>
{
{"hmac-md5", new HashInfo(16*8, HashAlgorithmFactory.CreateHMACMD5)},
{"hmac-md5-96", new HashInfo(16*8, key => HashAlgorithmFactory.CreateHMACMD5(key, 96))},
{"hmac-sha1", new HashInfo(20*8, HashAlgorithmFactory.CreateHMACSHA1)},
{"hmac-sha1-96", new HashInfo(20*8, key => HashAlgorithmFactory.CreateHMACSHA1(key, 96))},
{"hmac-sha2-256", new HashInfo(32*8, HashAlgorithmFactory.CreateHMACSHA256)},
{"hmac-sha2-256-96", new HashInfo(32*8, key => HashAlgorithmFactory.CreateHMACSHA256(key, 96))},
{"hmac-sha2-512", new HashInfo(64 * 8, HashAlgorithmFactory.CreateHMACSHA512)},
{"hmac-sha2-512-96", new HashInfo(64 * 8, key => HashAlgorithmFactory.CreateHMACSHA512(key, 96))},
//{"[email protected]", typeof(HMacSha1)},
{"hmac-ripemd160", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160)},
{"[email protected]", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160)},
//.........这里部分代码省略.........
示例7: KeyboardInteractiveConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username))
{
foreach (var authenticationMethod in this.AuthenticationMethods.OfType<KeyboardInteractiveAuthenticationMethod>())
{
authenticationMethod.AuthenticationPrompt += AuthenticationMethod_AuthenticationPrompt;
}
}
示例8: KeyboardInteractiveConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
this._requestMessage = new RequestMessageKeyboardInteractive(ServiceName.Connection, username);
}
示例9: PrivateKeyConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">The port.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
/// <param name="keyFiles">The key files.</param>
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params PrivateKeyFile[] keyFiles)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAuthenticationMethod(username, keyFiles))
{
this.KeyFiles = new Collection<PrivateKeyFile>(keyFiles);
}
示例10: MyProxy
public MyProxy(string address, int port, ProxyTypes type, string login = null, string password = null)
: base(address, port, type, login, password)
{
ErrorsCount = StartErrors;
}
示例11: KeyboardInteractiveConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
}
示例12: PasswordConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="username">Connection username.</param>
/// <param name="password">Connection password.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
: this(host, ConnectionInfo.DEFAULT_PORT, username, password, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
示例13: PasswordConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="port">The port.</param>
/// <param name="username">Connection username.</param>
/// <param name="password">Connection password.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
if (password == null)
throw new ArgumentNullException("password");
this._password = password;
this._requestMessage = new RequestMessagePassword(ServiceName.Connection, this.Username, password);
}
示例14: PrivateKeyConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="keyFiles">The key files.</param>
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, params PrivateKeyFile[] keyFiles)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)
{
}
示例15: PrivateKeyConnectionInfo
/// <summary>
/// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
/// <param name="host">Connection host.</param>
/// <param name="username">Connection username.</param>
/// <param name="proxyType">Type of the proxy.</param>
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
/// <param name="keyFiles">The key files.</param>
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params PrivateKeyFile[] keyFiles)
: this(host, 22, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles)
{
}