Ignore:
Timestamp:
Jan 28, 2010, 4:31:53 PM (12 years ago)
Author:
arnold
Message:

P2P stuff enhanced with peersAtPlay certification, so all certificates, which are necessary for using the p2p system will be checked and - in case of doubt - installed in the background before initializing the p2p system.
Furthermore the SimpleSnalNG was banned from the P2PBase, so you can only initialize the p2p system with the newer SnalNG, which supports certificates.

The lib is required by all developers, so I'm adding it explicitly to the repository.

override-bad-extension: opa.vs.uni-due.de.cer
override-bad-extension: pap.cer
override-bad-extension: pap0001.p12
override-bad-extension: ServerCA.cer
override-bad-extension: Bootstrapper.dll
override-bad-extension: Bootstrapper.pdb
override-bad-extension: CertServices.dll
override-bad-extension: CertServices.pdb
override-bad-extension: FullMeshDHT.dll
override-bad-extension: FullMeshDHT.pdb
override-bad-extension: FullMeshOverlay.dll
override-bad-extension: FullMeshOverlay.pdb
override-bad-extension: Gears4Net.dll
override-bad-extension: Gears4Net.pdb
override-bad-extension: LinkManager.dll
override-bad-extension: LinkManager.pdb
override-bad-extension: NetGearsTCP.dll
override-bad-extension: NetGearsTCP.pdb
override-bad-extension: PeersAtPlayBase.dll
override-bad-extension: PeersAtPlayBase.pdb
override-bad-extension: Stun.dll
override-bad-extension: Stun.pdb
override-bad-extension: Util.dll
override-bad-extension: Util.pdb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerBase/PeerToPeerBase.cs

    r1107 r1115  
    3131using PeersAtPlay;
    3232using PeersAtPlay.Util.Logging;
     33using Gears4Net;
    3334
    3435/* - Synchronous functions successfully tested (store, retrieve)
     
    4445 *   If this versioning system will be abolished, the SynchStore method must
    4546 *   be change!
     47 * - Everything switched to SnalNG, SimpleSnal isn't used anymore, because
     48 *   certification stuff runs now
    4649 *
    4750 * TODO:
     51 * - Delete UseNatTraversal-Flag and insert CertificateCheck and CertificateSetup
    4852 * - Testing asynchronous methods incl. EventHandlers
    4953 */
     
    118122        }
    119123
    120         private bool useNatTraversal = true;
    121         /// <summary>
    122         /// Initialization value = true!
    123         /// When you want to use NAT-Traversal (tunneling the P2P
    124         /// connection through NATs and Firewalls), you have to
    125         /// set this flag to true, before initializing this peer
    126         /// ATTENTION: At present you have to install two certificates
    127         /// manually on each workstation, where you want to use P2P@CT2,
    128         /// and set a static PeerName (pap0001) and P2PWorldName (TestBruteforcingWorld)
    129         /// TODO: Automatize the certificate stuff and implement a chance
    130         /// to choose own PeerNames and P2PWorldNames
    131         /// </summary>
    132         public bool UseNatTraversal
    133         {
    134             get { return this.useNatTraversal; }
    135             set { this.useNatTraversal = value; }
    136         }
    137 
    138124        private IDHT dht;
    139125        private IP2PLinkManager linkmanager;
     
    173159        /// <param name="overlayType"></param>
    174160        /// <param name="dhtType"></param>
    175         public void Initialize(string sUserName, string sWorldName, bool bolUseNatTraversal, P2PLinkManagerType linkManagerType, P2PBootstrapperType bsType, P2POverlayType overlayType, P2PDHTType dhtType)
    176         {
    177             this.UseNatTraversal = bolUseNatTraversal;
    178 
     161        public void Initialize(string sUserName, string sWorldName, P2PLinkManagerType linkManagerType, P2PBootstrapperType bsType, P2POverlayType overlayType, P2PDHTType dhtType)
     162        {
    179163            #region Setting LinkManager, Bootstrapper, Overlay and DHT to the specified types
    180164            switch (linkManagerType)
    181165            {
    182166                case P2PLinkManagerType.Snal:
    183                     //snal = secure network abstraction layer
    184                     if (UseNatTraversal)
    185                     {
    186                         if (bsType == P2PBootstrapperType.LocalMachineBootstrapper)
    187                             throw (new Exception("It's mindless to activate NAT traversal, but use the LocalMachineBootstrapper."));
    188 
    189                         LogToMonitor("Init LinkMgr: Using NAT Traversal stuff");
    190                         // NAT-Traversal stuff needs a different Snal-Version
    191                         this.linkmanager = new PeersAtPlay.P2PLink.SnalNG.Snal();
    192 
    193                         ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.ConnectInternal = false;
    194                         ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.LocalReceivingPort = 0;
    195                         ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.UseLocalAddressDetection = false;
    196                     }
    197                     else
    198                     {
    199                         this.linkmanager = new PeersAtPlay.P2PLink.SimpleSnalNG.Snal();
    200                     }
     167                    if (bsType == P2PBootstrapperType.LocalMachineBootstrapper)
     168                        throw (new Exception("It's mindless to activate NAT traversal, but use the LocalMachineBootstrapper."));
     169
     170                    LogToMonitor("Init LinkMgr: Using NAT Traversal stuff");
     171                    // NAT-Traversal stuff needs a different Snal-Version
     172                    this.linkmanager = new PeersAtPlay.P2PLink.SnalNG.Snal(new STAScheduler("crypt"));
     173
     174                    ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.ConnectInternal = true;
     175                    ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.LocalReceivingPort = 0;
     176                    ((PeersAtPlay.P2PLink.SnalNG.Snal)this.linkmanager).Settings.UseLocalAddressDetection = false;
    201177                    break;
    202178                default:
     
    210186                    break;
    211187                case P2PBootstrapperType.IrcBootstrapper:
    212                     if (UseNatTraversal)
    213                     {
    214                         LogToMonitor("Init Bootstrapper: Using NAT Traversal stuff");
    215                         PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.DelaySymmetricResponse = true;
    216                         PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.IncludeSymmetricInResponse = false;
    217                         PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.SymmetricResponseDelay = 6000;
    218                     }
    219                     else
    220                     {
    221                         PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.IncludeSymmetricInResponse = true;
    222                         PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.DelaySymmetricResponse = false;
    223                     }
     188                    // setup nat traversal stuff
     189                    LogToMonitor("Init Bootstrapper: Using NAT Traversal stuff");
     190                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.DelaySymmetricResponse = true;
     191                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.IncludeSymmetricInResponse = false;
     192                    PeersAtPlay.P2POverlay.Bootstrapper.IrcBootstrapper.Settings.SymmetricResponseDelay = 6000;
     193
    224194                    this.bootstrapper = new IrcBootstrapper();
    225195                    break;
Note: See TracChangeset for help on using the changeset viewer.