/// <summary> /// 启动身份验证过程 /// </summary> /// <param name="Connection"></param> /// <param name="Callback"></param> internal void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback) { this._Connection = Connection; this._Callback = Callback; try { _Bytes = null; Connection.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); } catch (Exception ex) { Log.AddLog("AuthBase处理身份验证过程时出错|" + ex.Message); Callback(false); } }
///<summary>Starts the authentication process.</summary> ///<param name="Connection">The connection with the SOCKS client.</param> ///<param name="Callback">The method to call when the authentication is complete.</param> internal override void StartAuthentication(SecureSocket Connection, AuthenticationCompleteDelegate Callback) { this.Connection = Connection; this.Callback = Callback; try { Bytes = null; Connection.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); } catch { Callback(false); } }
///<summary>Starts the authentication process.</summary> ///<param name="Connection">The connection with the SOCKS client.</param> ///<param name="Callback">The method to call when the authentication is complete.</param> internal override void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback) { this.Connection = Connection; this.Callback = Callback; try { Bytes = null; Connection.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); } catch { Callback(false); } }
internal void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback, Boolean a) { //_Connection = Connection; //_Callback = Callback; //try //{ // _Bytes = null; // Connection.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); //} //catch (Exception ex) { Log.AddLog("AuthBase处理身份验证过程2时出错|" + ex.Message); Callback(false); } // 这都是错误的代码 Callback(a); }
///<summary>Starts the authentication process.</summary> ///<remarks>This abstract method must be implemented in the subclasses, according to the selected subprotocol.</remarks> ///<param name="Connection">The connection with the SOCKS client.</param> ///<param name="Callback">The method to call when the authentication is complete.</param> internal abstract void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback);
///<summary>Calls the parent class to inform it authentication is complete.</summary> ///<param name="Connection">The connection with the SOCKS client.</param> ///<param name="Callback">The method to call when the authentication is complete.</param> internal override void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback) { Callback(true); }
///<summary>Starts the authentication process.</summary> ///<param name="Connection">The connection with the SOCKS client.</param> ///<param name="Callback">The method to call when the authentication is complete.</param> internal override async void StartAuthentication(SocketConnection Connection, AuthenticationCompleteDelegate Callback) { this.Connection = Connection; this.Callback = Callback; try { Bytes = null; await Connection.ReceiveAsync(Buffer, 0, Buffer.Length, OnRecvRequest); } catch (Exception ex) { Console.WriteLine("[WARN] " + ex.Message + "\r\n" + ex.StackTrace); Callback(Connection, false); } }