コード例 #1
0
        /**
         * Constructor.
         * @param brunetConfig configuration file for Brunet P2P library.
         * @param ipopConfig configuration file for IP over P2P app.
         */
        public SocialNode(string brunetConfig, string ipopConfig,
                          string certDir, string port) :
            base(brunetConfig, ipopConfig)
        {
            _friends  = new Dictionary <string, SocialUser>();
            _cert_dir = certDir;
            string cert_path = Path.Combine(certDir, CERTFILENAME);

            _local_cert     = new Certificate(SocialUtils.ReadFileBytes(cert_path));
            _local_user     = new SocialUser(_local_cert);
            _local_cert_b64 = Convert.ToBase64String(_local_cert.X509.RawData);
            _bso.CertificateHandler.AddCACertificate(_local_cert.X509);
            _bso.CertificateHandler.AddSignedCertificate(_local_cert.X509);
            _snp = new SocialNetworkProvider(this.Dht, _local_user);
            _srh = new SocialRpcHandler(_node, _local_user, _friends);
            _scm = new SocialConnectionManager(this, _snp, _snp, port, _friends,
                                               _srh);
        }
コード例 #2
0
ファイル: SocialNode.cs プロジェクト: j3g/socialvpn
 /**
  * Constructor.
  * @param brunetConfig configuration file for Brunet P2P library.
  * @param ipopConfig configuration file for IP over P2P app.
  */
 public SocialNode(NodeConfig brunetConfig, IpopConfig ipopConfig, 
               string certDir, string http_port, string jabber_port,
               string global_access)
     : base(brunetConfig, ipopConfig)
 {
     _friends = new Dictionary<string, SocialUser>();
       _aliases = new Dictionary<string, string>();
       _addr_to_key = new Dictionary<string, string>();
       _cert_dir = certDir;
       _http_port = http_port;
       string cert_path = Path.Combine(certDir, CERTFILENAME);
       _local_cert = new Certificate(SocialUtils.ReadFileBytes(cert_path));
       _local_user = new SocialUser(_local_cert);
       _local_cert_b64 = Convert.ToBase64String(_local_cert.X509.RawData);
       _bso.CertificateHandler.AddCACertificate(_local_cert.X509);
       _bso.CertificateHandler.AddSignedCertificate(_local_cert.X509);
       _queue = new BlockingQueue();
       _snp = new SocialNetworkProvider(this.Dht, _local_user,
                                _local_cert.X509.RawData, _queue,
                                jabber_port);
       _sdm = new SocialDnsManager(this, _local_user);
       _srh = new SocialRpcHandler(_node, _local_user, _friends, _queue, _sdm);
       _scm = new SocialConnectionManager(this, _snp, _srh, http_port, _queue,
                                  _sdm);
       _cert_published = false;
       _node.ConnectionTable.ConnectionEvent += ConnectHandler;
       _node.HeartBeatEvent += _scm.HeartBeatHandler;
       Shutdown.OnExit += _scm.Stop;
       _local_user.IP = _marad.LocalIP;
       CreateAlias(_local_user);
       _marad.MapLocalDNS(_local_user.Alias);
       _scm.GlobalAccess = (global_access == "on");
       LoadCertificates();
 }
コード例 #3
0
ファイル: SocialNode.cs プロジェクト: reith2004/socialvpn
 /**
  * Constructor.
  * @param brunetConfig configuration file for Brunet P2P library.
  * @param ipopConfig configuration file for IP over P2P app.
  */
 public SocialNode(string brunetConfig, string ipopConfig, 
               string certDir, string port)
     : base(brunetConfig, ipopConfig)
 {
     _friends = new Dictionary<string, SocialUser>();
       _cert_dir = certDir;
       string cert_path = Path.Combine(certDir, CERTFILENAME);
       _local_cert = new Certificate(SocialUtils.ReadFileBytes(cert_path));
       _local_user = new SocialUser(_local_cert);
       _local_cert_b64 = Convert.ToBase64String(_local_cert.X509.RawData);
       _bso.CertificateHandler.AddCACertificate(_local_cert.X509);
       _bso.CertificateHandler.AddSignedCertificate(_local_cert.X509);
       _snp = new SocialNetworkProvider(this.Dht, _local_user);
       _srh = new SocialRpcHandler(_node, _local_user, _friends);
       _scm = new SocialConnectionManager(this, _snp, _snp, port, _friends,
                                  _srh);
 }