Ejemplo n.º 1
0
 public TransferTransactionProcessor(
     IPeerTracker peerTracker,
     IObjectReader objectReader)
 {
     _peerTracker  = peerTracker;
     _objectReader = objectReader;
 }
Ejemplo n.º 2
0
        public LocalNode(INetworkListenerLoop networkListenerLoop,
                         IUPnPPortForwarder portForwarder,
                         ILocalIpAddressDiscoverer localIpAddressDiscoverer,
                         RemoteNode.Factory remoteNodeFactory,
                         IPeerTracker peerTracker,
                         ClientSettings clientSettings)
        {
            _uPnPPortForwarder = portForwarder;
            _peerTracker       = peerTracker;

            _networkListenerLoop = networkListenerLoop;
            _networkListenerLoop.ConnectionEstablished += HandleConnectionEstablished;

            _clientSettings    = clientSettings;
            _remoteNodeFactory = remoteNodeFactory;

            if (_clientSettings.BlockChainNetSettings.Net == "LocalNet")
            {
                _seedNodeEndPoint = new IPEndPoint(IPAddress.Parse(localIpAddressDiscoverer.GetLocalIpAddress()), _clientSettings.ListenPort);
            }
            int port = _clientSettings.BlockChainNetSettings?.ListenPortOverride ?? _clientSettings.ListenPort;

            LocalAddress = new IPEndPoint(IPAddress.Parse(localIpAddressDiscoverer.GetLocalIpAddress()), port);

            Console.WriteLine($"Started Listening on {LocalAddress.Address}:{LocalAddress.Port}");
            Console.WriteLine();
        }
Ejemplo n.º 3
0
        public LocalNode(
            INetworkListenerLoop networkListenerLoop,
            IUPnPPortForwarder portForwarder,
            ILocalIpAddressDiscoverer localIpAddressDiscoverer,
            RemoteNode.Factory remoteNodeFactory,
            IPeerTracker peerTracker,
            IPacketSender packetSender,
            ILoggerFactory loggerFactory,
            IMessageDispatcher messageDispatcher,
            ClientSettings clientSettings)
        {
            _logger = loggerFactory.CreateLogger <LocalNode>();

            _uPnPPortForwarder = portForwarder;
            _peerTracker       = peerTracker;

            _packetSender = packetSender;

            _networkListenerLoop = networkListenerLoop;
            //_networkListenerLoop.TcpConnectionEstablished += HandleConnectionEstablished;
            _networkListenerLoop.DatagramReceived += HandleDatagramReceived;

            _messageDispatcher = messageDispatcher;

            _clientSettings    = clientSettings;
            _remoteNodeFactory = remoteNodeFactory;

            int port = _clientSettings.BlockChainNetSettings.TcpPort;

            LocalAddress = new IPEndPoint(IPAddress.Parse(localIpAddressDiscoverer.GetLocalIpAddress()), port);

            _logger.LogInformation($"Started Listening on {LocalAddress.Address}:{LocalAddress.Port}");

            _keepAliveTimer = new Timer(BroadcastKeepAliveMessages, null, 0, _clientSettings.KeepAliveTimeout * 1000);


            _messageHeader              = new MessageHeader();
            _messageHeader.Extensions   = new byte[2];
            _messageHeader.VersionMax   = 5;
            _messageHeader.VersionMin   = 1;
            _messageHeader.VersionUsing = 5;
            _messageHeader.Type         = MessageType.Keepalive;
        }
 public KeepAliveMessageProcessor(IPeerTracker peerTracker)
 {
     _peerTracker = peerTracker;
 }
 public PublishMessageProcessor(IPeerTracker peerTracker)
 {
     _peerTracker = peerTracker;
 }
Ejemplo n.º 6
0
 public RequestPeerAddressMessageProcessor(IObjectReader objectReader, IPeerTracker peerTracker)
 {
     _objectReader = objectReader;
     _peerTracker  = peerTracker;
 }
Ejemplo n.º 7
0
 public HandShakeProcessor(ClientSettings clientSettings, IPeerTracker peerTracker)
 {
     _clientSettings = clientSettings;
     _peerTracker    = peerTracker;
 }
Ejemplo n.º 8
0
 public PeerAddressesPayloadMessageProcessor(IObjectReader objectReader, IPeerTracker peerTracker)
 {
     _objectReader = objectReader;
     _peerTracker  = peerTracker;
 }