@Override public boolean close(boolean forced) { int reg = _context.portMapper().getPort(PortMapper.SVC_HTTPS_PROXY); if (reg == getLocalPort()) _context.portMapper().unregister(PortMapper.SVC_HTTPS_PROXY); return super.close(forced); }
public void run() { I2PAppContext.getGlobalContext().portMapper().register(PortMapper.SVC_SAM_UDP, _host, _port); try { run2(); } finally { I2PAppContext.getGlobalContext().portMapper().unregister(PortMapper.SVC_SAM_UDP); } }
/** * Overridden to close internal socket too. */ @Override public boolean close(boolean forced) { int port = getLocalPort(); int reg = _context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY); if (reg == port) { _context.portMapper().unregister(PortMapper.SVC_HTTP_PROXY); } reg = _context.portMapper().getPort(PortMapper.SVC_HTTPS_PROXY); if (reg == port) { _context.portMapper().unregister(PortMapper.SVC_HTTPS_PROXY); } boolean rv = super.close(forced); if(this.isr != null) { this.isr.stopRunning(); } return rv; }
/** * Overridden to unregister with port mapper * * @since 0.9.27 */ @Override public boolean close(boolean forced) { int port = getLocalPort(); int reg = _context.portMapper().getPort(PortMapper.SVC_SMTP); if (reg == port) { _context.portMapper().unregister(PortMapper.SVC_SMTP); } reg = _context.portMapper().getPort(PortMapper.SVC_POP); if (reg == port) { _context.portMapper().unregister(PortMapper.SVC_POP); } boolean rv = super.close(forced); if (_isr != null) { _isr.stopRunning(); } return rv; } }
StringBuilder out = new StringBuilder(2048); try { boolean hasSusiDNS = ctx.portMapper().isRegistered(PortMapper.SVC_SUSIDNS); boolean hasI2PTunnel = ctx.portMapper().isRegistered(PortMapper.SVC_I2PTUNNEL); if (hasSusiDNS && hasI2PTunnel) { reader = new TranslateReader(ctx, BUNDLE_NAME, new FileInputStream(file)); String url = ctx.portMapper().getConsoleURL(); if (!url.equals("http://127.0.0.1:7657/")) { DataHelper.replace(out, "http://127.0.0.1:7657/", url);
@Override public boolean close(boolean forced) { int reg = _context.portMapper().getPort(PortMapper.SVC_IRC); if (reg == getLocalPort()) _context.portMapper().unregister(PortMapper.SVC_IRC); synchronized(this) { if (_DCCServer != null) { _DCCServer.close(forced); _DCCServer = null; } if (_DCCClientManager != null) { _DCCClientManager.close(forced); _DCCClientManager = null; } } return super.close(forced); }
@Override public void startRunning() { super.startRunning(); if (open) _context.portMapper().register(PortMapper.SVC_HTTPS_PROXY, getTunnel().listenHost, getLocalPort()); }
@Override public void startRunning() { super.startRunning(); if (open) _context.portMapper().register(PortMapper.SVC_IRC, getTunnel().listenHost, getLocalPort()); }
/** * ClientApp constructor used from clients.config * * @param mgr null OK * @param args URL in args[0] or null args for router console * @since 0.9.18 */ public UrlLauncher(I2PAppContext context, ClientAppManager mgr, String[] args) { _state = UNINITIALIZED; _context = context; _log = _context.logManager().getLog(UrlLauncher.class); _mgr = mgr; if (args == null || args.length <= 0) args = new String[] { context.portMapper().getConsoleURL() }; _args = args; _shellCommand = new ShellCommand(); _state = INITIALIZED; }
/** * Actually start working on incoming connections. * Overridden to start an internal socket too. * */ @Override public void startRunning() { // following are for HTTPResponseOutputStream //_context.statManager().createRateStat("i2ptunnel.httpCompressionRatio", "ratio of compressed size to decompressed size after transfer", "I2PTunnel", new long[] { 60*60*1000 }); //_context.statManager().createRateStat("i2ptunnel.httpCompressed", "compressed size transferred", "I2PTunnel", new long[] { 60*60*1000 }); //_context.statManager().createRateStat("i2ptunnel.httpExpanded", "size transferred after expansion", "I2PTunnel", new long[] { 60*60*1000 }); super.startRunning(); if (open) { this.isr = new InternalSocketRunner(this); this.isr.start(); int port = getLocalPort(); _context.portMapper().register(PortMapper.SVC_HTTP_PROXY, getTunnel().listenHost, port); _context.portMapper().register(PortMapper.SVC_HTTPS_PROXY, getTunnel().listenHost, port); } }
/** * Obsolete, now uses ClientApp interface */ public static void main(String args[]) { UrlLauncher launcher = new UrlLauncher(); try { if (args.length > 0) launcher.openUrl(args[0]); else launcher.openUrl(I2PAppContext.getGlobalContext().portMapper().getConsoleURL()); } catch (IOException e) {} } }
tbook = book; PortMapper pm = I2PAppContext.getGlobalContext().portMapper(); String conURL = pm.getConsoleURL(); out.write(("HTTP/1.1 200 OK\r\n"+
/** * Actually start working on incoming connections. * Overridden to register with port mapper. * * @since 0.9.27 */ @Override public void startRunning() { super.startRunning(); if (open) { I2PSocketAddress addr = pickDestination(); if (addr != null) { String svc = null; String hostname = addr.getHostName(); if ("smtp.postman.i2p".equals(hostname)) { svc = PortMapper.SVC_SMTP; } else if ("pop.postman.i2p".equals(hostname)) { svc = PortMapper.SVC_POP; } if (svc != null) { _isr = new InternalSocketRunner(this); _isr.start(); _context.portMapper().register(svc, getTunnel().listenHost, getLocalPort()); } } } }
/** * Yes, the EepGet fetch() is done in here in next(). * * see java.util.Iterator#next() * @return non-null AddressBook (empty if the minimum delay has not been met, * or there is no proxy tunnel, or the fetch otherwise fails) */ public AddressBook next() { Subscription sub = this.subIterator.next(); if (sub.getLocation().startsWith("file:")) { // test only return new AddressBook(sub.getLocation().substring(5)); } else if (sub.getLastFetched() + this.delay < I2PAppContext.getGlobalContext().clock().now() && I2PAppContext.getGlobalContext().portMapper().getPort(PortMapper.SVC_HTTP_PROXY) >= 0 && !I2PAppContext.getGlobalContext().getBooleanProperty("i2p.vmCommSystem")) { //System.err.println("Fetching addressbook from " + sub.getLocation()); return new AddressBook(sub, this.proxyHost, this.proxyPort); } else { //System.err.println("Addressbook " + sub.getLocation() + " was last fetched " + // DataHelper.formatDuration(I2PAppContext.getGlobalContext().clock().now() - sub.getLastFetched()) + // " ago but the minimum delay is " + // DataHelper.formatDuration(this.delay)); return new AddressBook(Collections.<String, HostTxtEntry>emptyMap()); } }
lc.start(); if (_context != null) { PortMapper pm = _context.portMapper(); if (lc instanceof Server) { Server server = (Server) lc;
if (_mgr != null) _mgr.register(this); I2PAppContext.getGlobalContext().portMapper().register(_useSSL ? PortMapper.SVC_SAM_SSL : PortMapper.SVC_SAM, _listenHost != null ? _listenHost : "127.0.0.1", _listenPort); serverSocket.close(); } catch (IOException e) {} I2PAppContext.getGlobalContext().portMapper().unregister(_useSSL ? PortMapper.SVC_SAM_SSL : PortMapper.SVC_SAM); stopHandlers(); changeState(STOPPED);
if (_mgr != null) _mgr.register(this); _context.portMapper().register(PortMapper.SVC_BOB, props.getProperty(PROP_BOB_HOST), Integer.parseInt(props.getProperty(PROP_BOB_PORT))); } finally { _log.info("BOB is now shutting down..."); _context.portMapper().unregister(PortMapper.SVC_BOB);
public void run() { for (LifeCycle lc : _jettys) { if (lc.isRunning()) { try { lc.stop(); } catch (Exception e) { changeState(STOPPING, e); } } } if (_context != null) { PortMapper pm = _context.portMapper(); if (_port > 0 && pm.getPort(PortMapper.SVC_EEPSITE) == _port) { _port = 0; pm.unregister(PortMapper.SVC_EEPSITE); } if (_sslPort > 0 && pm.getPort(PortMapper.SVC_HTTPS_EEPSITE) == _sslPort) { _sslPort = 0; pm.unregister(PortMapper.SVC_HTTPS_EEPSITE); } } changeState(STOPPED); } }
Hash h2 = ConvertToHash.getHash(ahelperKey); if (h1 != null && h2 != null) { String conURL = _context.portMapper().getConsoleURL(); out.write(("\n<table class=\"conflict\"><tr><th align=\"center\">" + "<a href=\"" + trustedURL + "\">").getBytes("UTF-8")); out.write(_t("Conflicting address helper destination").getBytes("UTF-8")); out.write(("</a></th></tr>\n").getBytes("UTF-8")); if (_context.portMapper().isRegistered(PortMapper.SVC_IMAGEGEN)) { out.write(("<tr><td align=\"center\">" + "<a href=\"" + trustedURL + "\">" +