mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	removed NTCP
This commit is contained in:
		
							parent
							
								
									d595006d1f
								
							
						
					
					
						commit
						faae2709d9
					
				
					 9 changed files with 30 additions and 1677 deletions
				
			
		| 
						 | 
				
			
			@ -1,11 +1,3 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2013-2020, The PurpleI2P Project
 | 
			
		||||
*
 | 
			
		||||
* This file is part of Purple i2pd project and licensed under BSD3
 | 
			
		||||
*
 | 
			
		||||
* See full license text in LICENSE file at top of project tree
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <thread>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +9,6 @@
 | 
			
		|||
#include "Base.h"
 | 
			
		||||
#include "version.h"
 | 
			
		||||
#include "Transports.h"
 | 
			
		||||
#include "NTCPSession.h"
 | 
			
		||||
#include "RouterInfo.h"
 | 
			
		||||
#include "RouterContext.h"
 | 
			
		||||
#include "Tunnel.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -135,8 +126,8 @@ namespace i2p
 | 
			
		|||
			i2p::context.SetNetID (netID);
 | 
			
		||||
			i2p::context.Init ();
 | 
			
		||||
 | 
			
		||||
			bool ipv6; i2p::config::GetOption("ipv6", ipv6);
 | 
			
		||||
			bool ipv4; i2p::config::GetOption("ipv4", ipv4);
 | 
			
		||||
			bool ipv6;		i2p::config::GetOption("ipv6", ipv6);
 | 
			
		||||
			bool ipv4;		i2p::config::GetOption("ipv4", ipv4);
 | 
			
		||||
#ifdef MESHNET
 | 
			
		||||
			// manual override for meshnet
 | 
			
		||||
			ipv4 = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -151,8 +142,8 @@ namespace i2p
 | 
			
		|||
			i2p::context.SetSupportsV6 (ipv6);
 | 
			
		||||
			i2p::context.SetSupportsV4 (ipv4);
 | 
			
		||||
 | 
			
		||||
			bool ntcp; i2p::config::GetOption("ntcp", ntcp);
 | 
			
		||||
			i2p::context.PublishNTCPAddress (ntcp, !ipv6);
 | 
			
		||||
			bool ntcp;   i2p::config::GetOption("ntcp", ntcp);
 | 
			
		||||
			i2p::context.PublishNTCPAddress (ntcp, !ipv6);  
 | 
			
		||||
			bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
 | 
			
		||||
			if (ntcp2)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -180,13 +171,10 @@ namespace i2p
 | 
			
		|||
			SetMaxNumTransitTunnels (transitTunnels);
 | 
			
		||||
 | 
			
		||||
			bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
 | 
			
		||||
			if (isFloodfill)
 | 
			
		||||
			{
 | 
			
		||||
			if (isFloodfill) {
 | 
			
		||||
				LogPrint(eLogInfo, "Daemon: router will be floodfill");
 | 
			
		||||
				i2p::context.SetFloodfill (true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
			}	else {
 | 
			
		||||
				i2p::context.SetFloodfill (false);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -254,8 +242,7 @@ namespace i2p
 | 
			
		|||
					i2p::transport::transports.RestrictRoutesToFamilies(fams);
 | 
			
		||||
					restricted  = fams.size() > 0;
 | 
			
		||||
				}
 | 
			
		||||
				if (routers.length() > 0)
 | 
			
		||||
				{
 | 
			
		||||
				if (routers.length() > 0) {
 | 
			
		||||
					std::set<i2p::data::IdentHash> idents;
 | 
			
		||||
					size_t pos = 0, comma;
 | 
			
		||||
					do
 | 
			
		||||
| 
						 | 
				
			
			@ -291,8 +278,7 @@ namespace i2p
 | 
			
		|||
			i2p::data::netdb.Start();
 | 
			
		||||
 | 
			
		||||
			bool upnp; i2p::config::GetOption("upnp.enabled", upnp);
 | 
			
		||||
			if (upnp)
 | 
			
		||||
			{
 | 
			
		||||
			if (upnp) {
 | 
			
		||||
				d.UPnP = std::unique_ptr<i2p::transport::UPnP>(new i2p::transport::UPnP);
 | 
			
		||||
				d.UPnP->Start ();
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -304,16 +290,16 @@ namespace i2p
 | 
			
		|||
				d.m_NTPSync->Start ();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			bool ntcp; i2p::config::GetOption("ntcp", ntcp);
 | 
			
		||||
			bool ssu;  i2p::config::GetOption("ssu", ssu);
 | 
			
		||||
			bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
 | 
			
		||||
			bool ssu; i2p::config::GetOption("ssu", ssu);
 | 
			
		||||
			LogPrint(eLogInfo, "Daemon: starting Transports");
 | 
			
		||||
			if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
 | 
			
		||||
			if(!ntcp) LogPrint(eLogInfo, "Daemon: ntcp disabled");
 | 
			
		||||
			if(!ntcp2) LogPrint(eLogInfo, "Daemon: ntcp2 disabled");
 | 
			
		||||
 | 
			
		||||
			i2p::transport::transports.Start(ntcp, ssu);
 | 
			
		||||
			if (i2p::transport::transports.IsBoundNTCP() || i2p::transport::transports.IsBoundSSU() || i2p::transport::transports.IsBoundNTCP2())
 | 
			
		||||
			i2p::transport::transports.Start(ntcp2, ssu);
 | 
			
		||||
			if (i2p::transport::transports.IsBoundSSU() || i2p::transport::transports.IsBoundNTCP2()) 
 | 
			
		||||
				LogPrint(eLogInfo, "Daemon: Transports started");
 | 
			
		||||
			else
 | 
			
		||||
			else 
 | 
			
		||||
			{
 | 
			
		||||
				LogPrint(eLogError, "Daemon: failed to start Transports");
 | 
			
		||||
				/** shut down netdb right away */
 | 
			
		||||
| 
						 | 
				
			
			@ -323,23 +309,23 @@ namespace i2p
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
			bool http; i2p::config::GetOption("http.enabled", http);
 | 
			
		||||
			if (http)
 | 
			
		||||
			{
 | 
			
		||||
			if (http) {
 | 
			
		||||
				std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
 | 
			
		||||
				uint16_t    httpPort; i2p::config::GetOption("http.port", httpPort);
 | 
			
		||||
				LogPrint(eLogInfo, "Daemon: starting webconsole at ", httpAddr, ":", httpPort);
 | 
			
		||||
				try
 | 
			
		||||
				try 
 | 
			
		||||
				{
 | 
			
		||||
					d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
 | 
			
		||||
					d.httpServer->Start();
 | 
			
		||||
				}
 | 
			
		||||
				catch (std::exception& ex)
 | 
			
		||||
				} 
 | 
			
		||||
				catch (std::exception& ex) 
 | 
			
		||||
				{
 | 
			
		||||
					LogPrint (eLogError, "Daemon: failed to start webconsole: ", ex.what ());
 | 
			
		||||
					ThrowFatal ("Unable to start webconsole at ", httpAddr, ":", httpPort, ": ", ex.what ());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			LogPrint(eLogInfo, "Daemon: starting Tunnels");
 | 
			
		||||
			i2p::tunnel::tunnels.Start();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -352,12 +338,12 @@ namespace i2p
 | 
			
		|||
				std::string i2pcpAddr; i2p::config::GetOption("i2pcontrol.address", i2pcpAddr);
 | 
			
		||||
				uint16_t    i2pcpPort; i2p::config::GetOption("i2pcontrol.port",    i2pcpPort);
 | 
			
		||||
				LogPrint(eLogInfo, "Daemon: starting I2PControl at ", i2pcpAddr, ":", i2pcpPort);
 | 
			
		||||
				try
 | 
			
		||||
				try 
 | 
			
		||||
				{
 | 
			
		||||
					d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort));
 | 
			
		||||
					d.m_I2PControlService->Start ();
 | 
			
		||||
				}
 | 
			
		||||
				catch (std::exception& ex)
 | 
			
		||||
				} 
 | 
			
		||||
				catch (std::exception& ex) 
 | 
			
		||||
				{
 | 
			
		||||
					LogPrint (eLogError, "Daemon: failed to start I2PControl: ", ex.what ());
 | 
			
		||||
					ThrowFatal ("Unable to start I2PControl service at ", i2pcpAddr, ":", i2pcpPort, ": ", ex.what ());
 | 
			
		||||
| 
						 | 
				
			
			@ -374,7 +360,7 @@ namespace i2p
 | 
			
		|||
			LogPrint(eLogInfo, "Daemon: stopping Tunnels");
 | 
			
		||||
			i2p::tunnel::tunnels.Stop();
 | 
			
		||||
 | 
			
		||||
			if (d.UPnP)
 | 
			
		||||
			if (d.UPnP) 
 | 
			
		||||
			{
 | 
			
		||||
				d.UPnP->Stop ();
 | 
			
		||||
				d.UPnP = nullptr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -732,13 +732,6 @@ namespace http {
 | 
			
		|||
	void ShowTransports (std::stringstream& s)
 | 
			
		||||
	{
 | 
			
		||||
		s << "<b>Transports:</b><br>\r\n";
 | 
			
		||||
		auto ntcpServer = i2p::transport::transports.GetNTCPServer ();
 | 
			
		||||
		if (ntcpServer)
 | 
			
		||||
		{
 | 
			
		||||
			auto sessions = ntcpServer->GetNTCPSessions ();
 | 
			
		||||
			if (!sessions.empty ())
 | 
			
		||||
				ShowNTCPTransports (s, sessions, "NTCP");
 | 
			
		||||
		}
 | 
			
		||||
		auto ntcp2Server = i2p::transport::transports.GetNTCP2Server ();
 | 
			
		||||
		if (ntcp2Server)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue