Exemplo n.º 1
0
        /// <summary>
        /// .NET constructor used to set default property values.
        /// </summary>
        private PeerBuilder(Number160 peerId, KeyPair keyPair)
        {
            PeerId = peerId;
            KeyPair = keyPair;

            P2PId = -1;
            TcpPort = -1;
            UdpPort = -1;
            TcpPortForwarding = -1;
            UdpPortForwarding = -1;
            InterfaceBindings = null;
            ExternalBindings = null;
            PeerMap = null;
            MasterPeer = null;
            ChannelServerConfiguration = null;
            ChannelClientConfiguration = null;
            BroadcastHandler = null;
            BloomfilterFactory = null;
            MaintenanceTask = null;

            IsEnabledHandshakeRpc = true;
            IsEnabledNeighborRpc = true;
            IsEnabledDirectDataRpc = true;
            IsEnabledBroadcastRpc = true;
            IsEnabledRoutingRpc = true;
            IsEnabledMaintenance = true;
            IsEnabledQuitRpc = true;
        }
Exemplo n.º 2
0
        public Message SetPublicKeyAndSign(KeyPair keyPair)
        {
            if (!_presetContentTypes)
            {
                SetContentType(Content.PublicKeySignature);
            }
            SetPublicKey0(keyPair.PublicKey);
            PrivateKey = keyPair.PrivateKey;

            return this;
        }
Exemplo n.º 3
0
 public PeerBuilder SetKeyPair(KeyPair keyPair)
 {
     KeyPair = keyPair;
     return this;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a peer builder with the provided key pair and a peer ID that is
 /// generated out of this key pair.
 /// </summary>
 /// <param name="keyPair">The public private key pair.</param>
 public PeerBuilder(KeyPair keyPair)
     : this(Utils.Utils.MakeShaHash(keyPair.PublicKey.GetEncoded()), keyPair)
 { }
Exemplo n.º 5
0
 /// <summary>
 /// Sets a new key pair for this peer.
 /// </summary>
 /// <param name="keyPair">The new private and public key for this peer.</param>
 /// <returns>This class.</returns>
 public PeerBean SetKeyPair(KeyPair keyPair)
 {
     KeyPair = keyPair;
     return this;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a peer bean with a key pair.
 /// </summary>
 /// <param name="keyPair">The key pair that holds private and public key.</param>
 public PeerBean(KeyPair keyPair)
 {
     KeyPair = keyPair;
     PeerStatusListeners = new List<IPeerStatusListener>(1);
     OpenPeerConnections = new ConcurrentDictionary<Number160, PeerConnection>();
 }