Example #1
0
 public void OnClientDisconnected(AsyncTCPLib.OnClientDisconnectedEventArgs <AsyncTCPLib.VirtualClient> e)
 {
     Association.Carrier userCarrier = this._associations[e.Client.Id];
     if (userCarrier != null)
     {
         long accountId = Program.GetInstance().Server.Clients[e.Client.Id].Data.AuthenticationInfo.Id;
         if (userCarrier.Command == Socks.Constants.Command.Connect)
         {
             Association.ConnectProxy proxy = (Association.ConnectProxy)userCarrier.Data;
             Commit.Info info = new Commit.Info(accountId);
             if (userCarrier.WiredTx > 0 ||
                 userCarrier.WiredRx > 0)
             {
                 info.Stats = new Commit.Stats(userCarrier.WiredTx, userCarrier.WiredRx);
             }
             info.Command = new Commit.Command(
                 userCarrier.Command,
                 e.Client.RemoteEndPoint,
                 proxy.Client.RemoteEndPoint,
                 userCarrier.WiredTx,
                 userCarrier.WiredRx,
                 userCarrier.CommandTime,
                 userCarrier.CommandSuccess
                 );
             this._plugin.CommitInfo(info);
         }
         this._associations[e.Client.Id] = null;
     }
 }
Example #2
0
 /// <summary>
 /// Transmission for proxy sockeet from client socket
 /// </summary>
 /// <param name="data">Data from client socket to proxy socket</param>
 public async Task Transmission(byte[] data)
 {
     if (this.Command == Socks.Constants.Command.Connect)
     {
         ConnectProxy userData = (ConnectProxy)this.Data;
         if (userData.Client.IsConnected)
         {
             await userData.Client.Send(data);
         }
         else
         {
             return;
         }
     }
     this.WiredTx += data.Length;
 }