Example #1
0
        protected virtual void DoWork()
        {
            BanCheckUser bcu = PopUser();

            while (bcu != null)
            {
                BanProcessrUserArgs args = new BanProcessrUserArgs();
                args.User  = bcu.User;
                args.Token = bcu.Token;

                bool ipCheckValid = false;

                if (bcu.User.SocketConnection.RemoteEndPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    if (!Bans.CheckIPV4(bcu.User.SocketConnection.RemoteEndPoint.Address.ToString()))
                    {
                        ipCheckValid = true;
                    }
                }
                else if (bcu.User.SocketConnection.RemoteEndPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
                {
                    if (!Bans.CheckIPV6(bcu.User.SocketConnection.RemoteEndPoint.Address.ToString()))
                    {
                        ipCheckValid = true;
                    }
                }

                if (ipCheckValid)
                {
                    if (Bans.CheckHost(System.Net.Dns.GetHostEntry(bcu.User.SocketConnection.RemoteEndPoint.Address).HostName))
                    {
                        args.Results = BanProcessrUserArgs.ResultTypes.RejectedHost;
                    }
                    else
                    {
                        args.Results = BanProcessrUserArgs.ResultTypes.Accepted;
                    }
                }
                else
                {
                    args.Results = BanProcessrUserArgs.ResultTypes.RejectedIP;
                }


                bcu.CallCallback(args);


                bcu = PopUser();
            }

            Worker = null;
        }
Example #2
0
 public void CallCallback(BanProcessrUserArgs args)
 {
     Callback?.Invoke(User, args);
 }