📄 replyquerymethodsocks5message.cs
字号:
namespace Imps.Client.CommLayer.SocksSipConnection
{
using System;
internal sealed class ReplyQueryMethodSocks5Message : Socks5Message
{
private byte[] _authKey;
private SocksMethod _method;
private ReplyQueryMethodSocks5Message(SocksMethod method, byte[] authKey)
{
this.Method = method;
this.AuthKey = authKey;
}
public static ReplyQueryMethodSocks5Message Parse(byte[] buffer)
{
ReplyQueryMethodSocks5Message message;
try
{
if (buffer == null)
{
throw new ArgumentException("MethodSelectionReplySocksMessage.Parse()的参数buffer无效!");
}
if (buffer[0] != 5)
{
throw new ArgumentException("协议版本不符");
}
byte num1 = buffer[0];
SocksMethod method = (SocksMethod) buffer[1];
byte[] authKey = null;
message = new ReplyQueryMethodSocks5Message(method, authKey);
}
catch (Exception exception)
{
throw new SocksConnectionException("代理服务器对验证方法查询的应答无效", exception, SocksConnectionErrorCode.ReplyError);
}
return message;
}
public override byte[] ToBinary()
{
return new byte[] { base.Ver, this.Method };
}
public override string ToString()
{
return string.Concat(new object[] { "VER : ", base.Ver, "METHOD : ", this.Method });
}
public byte[] AuthKey
{
get
{
return this._authKey;
}
private set
{
this._authKey = value;
}
}
public bool IsNeedAuthKey
{
get
{
return (this.AuthKey != null);
}
}
public SocksMethod Method
{
get
{
return this._method;
}
private set
{
this._method = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -