Changeset 4ad6d69


Ignore:
Timestamp:
Jan 10, 2012 12:05:17 AM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
8e20e7a, ba5be74
Parents:
c6e6a9d
Message:
  • Router:
    • Auto-hidden mode for bad countries
    • Don't put addresses in our RouterInfo? when hidden
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHandler.java

    rc6e6a9d r4ad6d69  
    141141        if (!_ratesOnly) {
    142142            // IP Settings
    143             String oldUdp = _context.getProperty(UDPTransport.PROP_SOURCES, UDPTransport.DEFAULT_SOURCES);
     143            String oldUdp = _context.getProperty(UDPTransport.PROP_SOURCES,
     144                                                 _context.router().isHidden() ? "hidden" : UDPTransport.DEFAULT_SOURCES);
    144145            String oldUHost = _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
    145146            if (_udpAutoIP != null) {
  • apps/routerconsole/jsp/confignet.jsp

    rc6e6a9d r4ad6d69  
    158158<li class="tidylist"><b><%=intl._("Hidden")%></b> -
    159159     <%=intl._("The router is not configured to publish its address, therefore it does not expect incoming connections.")%>
     160     <%=intl._("Hidden mode is automatically enabled for added protection in certain countries.")%>
    160161<li class="tidylist"><b><%=intl._("WARN - Firewalled and Fast")%></b> -
    161162     <%=intl._("You have configured I2P to share more than 128KBps of bandwidth, but you are firewalled.")%>
  • history.txt

    rc6e6a9d r4ad6d69  
     12012-01-10 zzz
     2  * Console:
     3    - Add info to error 500 page
     4    - Add indication on summary bar when in VM comm system
     5    - Make graceful the default for HUP (ticket #580)
     6    - Fix class error on wrapper 3.1.1
     7  * i2prouter: Don't attempt to translate strings from script
     8  * Router:
     9    - Auto-hidden mode for bad countries
     10    - Don't put addresses in our RouterInfo when hidden
     11
    1122012-01-08 zzz
    213  * Plugins:
  • router/java/src/net/i2p/router/CommSystemFacade.java

    rc6e6a9d r4ad6d69  
    6262    public byte[] getIP(Hash dest) { return null; }
    6363    public void queueLookup(byte[] ip) {}
     64
    6465    /** @since 0.8.11 */
    6566    public String getOurCountry() { return null; }
     67
     68    /** @since 0.8.13 */
     69    public boolean isInBadCountry() { return false; }
     70
    6671    public String getCountry(Hash peer) { return null; }
    6772    public String getCountryName(String code) { return code; }
     
    7075    }
    7176   
     77    /** @since 0.8.13 */
     78    public boolean isDummy() { return true; }
     79
    7280    /**
    7381     * Tell other transports our address changed
  • router/java/src/net/i2p/router/Router.java

    rc6e6a9d r4ad6d69  
    242242            _config.put("router.firstInstalled", now);
    243243            _config.put("router.updateLastInstalled", now);
    244             // only compatible with new i2prouter script
    245             _config.put("router.gracefulHUP", "true");
    246244            saveConfig();
    247245        }
     
    593591        if ( (ri != null) && (ri.isHidden()) )
    594592            return true;
    595         return _context.getBooleanProperty(PROP_HIDDEN_HIDDEN);
    596     }
    597 
    598     /**
     593        String h = _context.getProperty(PROP_HIDDEN_HIDDEN);
     594        if (h != null)
     595            return Boolean.valueOf(h).booleanValue();
     596        return _context.commSystem().isInBadCountry();
     597    }
     598
     599    /**
     600     *  Only called at startup via LoadRouterInfoJob and RebuildRouterInfoJob.
     601     *  Not called by periodic RepublishLocalRouterInfoJob.
     602     *  We don't want to change the cert on the fly as it changes the router hash.
     603     *  RouterInfo.isHidden() checks the capability, but RouterIdentity.isHidden() checks the cert.
     604     *  There's no reason to ever add a hidden cert?
    599605     *  @return the certificate for a new RouterInfo - probably a null cert.
    600606     */
    601607    public Certificate createCertificate() {
    602         if (isHidden())
     608        if (_context.getBooleanProperty(PROP_HIDDEN))
    603609            return new Certificate(Certificate.CERTIFICATE_TYPE_HIDDEN, null);
    604610        return Certificate.NULL_CERT;
  • router/java/src/net/i2p/router/RouterVersion.java

    rc6e6a9d r4ad6d69  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 1;
     21    public final static long BUILD = 2;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java

    rc6e6a9d r4ad6d69  
    177177    }
    178178   
     179    /** @return non-null, possibly empty */
    179180    @Override
    180181    public Set<RouterAddress> createAddresses() {
     182        if (_context.router().isHidden())
     183            return Collections.EMPTY_SET;
    181184        Map<String, RouterAddress> addresses = null;
    182185        boolean newCreated = false;
     
    452455
    453456    /**
     457     *  Are we in a bad place
     458     *  @since 0.8.13
     459     */
     460    public boolean isInBadCountry() {
     461        String us = getOurCountry();
     462        return us != null && (BadCountries.contains(us) || _context.getBooleanProperty("router.forceBadCountry"));
     463    }
     464
     465    /**
    454466     *  Uses the transport IP first because that lookup is fast,
    455467     *  then the SSU IP from the netDb.
     
    518530    }
    519531
     532    /** @since 0.8.13 */
     533    @Override
     534    public boolean isDummy() { return false; }
     535
    520536    /**
    521537     *  Translate
  • router/java/src/net/i2p/router/transport/GeoIP.java

    rc6e6a9d r4ad6d69  
    2222import net.i2p.data.DataHelper;
    2323import net.i2p.data.Hash;
     24import net.i2p.router.Router;
    2425import net.i2p.router.RouterContext;
    2526import net.i2p.util.ConcurrentHashSet;
     
    284285            _context.router().setConfigSetting(PROP_IP_COUNTRY, country);
    285286            _context.router().saveConfig();
     287            if (_context.commSystem().isInBadCountry() && _context.getProperty(Router.PROP_HIDDEN_HIDDEN) == null) {
     288                String name = fullName(country);
     289                if (name == null)
     290                    name = country;
     291                _log.logAlways(Log.WARN, "Setting hidden mode to protect you in " + name +
     292                                         ", you may override on the network configuration page");
     293                _context.router().rebuildRouterInfo();
     294            }
    286295        }
    287296        /****/
Note: See TracChangeset for help on using the changeset viewer.