/// <summary> /// IDatabase.CommitConnection implementation for MySQL driver /// </summary> public Task <object> CommitCommand(Plugin.IDatabaseConnection clientImpl, long accountId, Socks.Constants.Command command, System.Net.IPEndPoint clientEndPoint, System.Net.IPEndPoint proxyEndPoint, long wiredTx, long wiredRx, DateTime commandTime, bool success) { VirtualConnection connection = clientImpl as VirtualConnection; uint sourceAddr = BitConverter.ToUInt32(clientEndPoint.Address.GetAddressBytes(), 0); uint targetAddr = BitConverter.ToUInt32(proxyEndPoint.Address.GetAddressBytes(), 0); connection .Command("INSERT INTO `commands` (`accountId`, `commandType`, `sourceAddr`, `sourcePort`, `targetAddr`, `targetPort`, `wiredTx`, `wiredRx`, `timestamp`, `success`) VALUES (@accountId, @command, @sourceAddr, @sourcePort, @targetAddr, @targetPort, @wiredTx, @wiredRx, @commandTime, @success);") .SetParameter("@accountId", accountId) .SetParameter("@command", command.ToString()) .SetParameter("@sourceAddr", sourceAddr) .SetParameter("@sourcePort", clientEndPoint.Port) .SetParameter("@targetAddr", targetAddr) .SetParameter("@targetPort", proxyEndPoint.Port) .SetParameter("@wiredTx", wiredTx) .SetParameter("@wiredRx", wiredRx) .SetParameter("@commandTime", commandTime) .SetParameter("@success", success) .Execute(); connection.IsBusy = false; return(Task.FromResult <object>(null)); }
public Carrier(Socks.Constants.Command command, params object[] args) { this.Command = command; this.CommandTime = DateTime.Now; if (command == Socks.Constants.Command.Connect) { this.Data = new ConnectProxy( args[0] as IPEndPoint, (ProtocolType)args[1], args[2] as byte[] ); } else if (command == Socks.Constants.Command.UdpAssociate) { this.Data = new UdpProxy( args[0] as IPEndPoint, (ProtocolType)args[1], args[2] as byte[] ); } else { throw new NotImplementedException("Did not implement Carrier type " + command.ToString()); } }