Provides information about a given ip address and let plugins decide if the present address is alowed to join
Inheritance: System.EventArgs
 public override void AllowJoining(CheckIPEventArgs args)
 {
     foreach (PluginBase item in _triggerPlugins)
     {
         try
         {
             item.AllowJoining(args);
         }
         catch (Exception ex)
         {
             _logger.Warn("Could not pass event 'AllowJoining' to " + item.Name, ex);
         }
     }
 }
Exemplo n.º 2
0
        private async void ReceiveClientsAsync()
        {
            _acceptingNewClients = true;
            while (true)
            {
                try
                {
                    Socket remote = await _listeningSocket.AcceptTaskAsync ();

                    IPAddress address = ((IPEndPoint) remote.RemoteEndPoint).Address;
                    var args = new CheckIPEventArgs(address, true);

                    PluginManager.TriggerPlugin.AllowJoining(args);

                    if (!args.AllowJoining)
                    {
                        remote.Close ();
                        _logger.Warn("Denied access from " + address);
                        continue;
                    }
                    //Connection accepted

                    var proxyConnection = new ProxyConnection(remote, this);

                    _openConnection.Add(proxyConnection);


                    proxyConnection.HandleClient ();
                }
                catch (TaskCanceledException)
                {
                    _acceptingNewClients = false;
                    return;
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///   This method is being called at the beginning when a new client connects to the proxy server. A plugin can decide to allow, or deny the incoming connection.
 /// </summary>
 /// <param name="args"> The IP address of the remote client </param>
 /// <returns> true, if the client is allowed to join, false if not. The plugin should return null if the plugin can not decide whether the client is allowed or is not allowed to join. </returns>
 public virtual void AllowJoining(CheckIPEventArgs args)
 {
 }