Changeset c6e401a for core


Ignore:
Timestamp:
Mar 4, 2018 12:30:36 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
419d411b
Parents:
3bc9053
Message:

PortMapper?: HTTPS console fallback to HTTP
Console port constants

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/PortMapper.java

    r3bc9053 rc6e401a  
    4747    public static final String SVC_HTTPS_I2PCONTROL = "https_i2pcontrol";
    4848
     49    /** @since 0.9.34 */
     50    public static final int DEFAULT_CONSOLE_PORT = 7657;
     51    /** @since 0.9.34 */
     52    public static final int DEFAULT_HTTPS_CONSOLE_PORT = 7667;
     53    /** @since 0.9.34 */
     54    public static final String DEFAULT_HOST = "127.0.0.1";
     55
     56
    4957    /**
    5058     *  @param context unused for now
     
    6068     */
    6169    public boolean register(String service, int port) {
    62         return register(service, "127.0.0.1", port);
     70        return register(service, DEFAULT_HOST, port);
    6371    }
    6472
     
    210218        String httpHost = getActualHost(SVC_CONSOLE, unset);
    211219        String httpsHost = getActualHost(SVC_HTTPS_CONSOLE, unset);
    212         int httpPort = getPort(SVC_CONSOLE, 7657);
     220        int httpPort = getPort(SVC_CONSOLE, DEFAULT_CONSOLE_PORT);
    213221        int httpsPort = getPort(SVC_HTTPS_CONSOLE);
    214222        boolean httpsOnly = httpsPort > 0 && httpHost.equals(unset) && !httpsHost.equals(unset);
     
    216224            return "https://" + httpsHost + ':' + httpsPort + '/';
    217225        if (httpHost.equals(unset))
    218             httpHost = "127.0.0.1";
     226            httpHost = DEFAULT_HOST;
    219227        return "http://" + httpHost + ':' + httpPort + '/';
    220228    }
    221229
    222230    /**
    223      *  @return https URL unless console is http only. Default https://127.0.0.1:7667/
     231     *  @return https URL unless console is http only. Default http://127.0.0.1:7657/
    224232     *  @since 0.9.34
    225233     */
     
    229237        String httpsHost = getActualHost(SVC_HTTPS_CONSOLE, unset);
    230238        int httpPort = getPort(SVC_CONSOLE);
    231         int httpsPort = getPort(SVC_HTTPS_CONSOLE, 7667);
     239        int httpsPort = getPort(SVC_HTTPS_CONSOLE, DEFAULT_HTTPS_CONSOLE_PORT);
    232240        boolean httpOnly = httpPort > 0 && httpsHost.equals(unset) && !httpHost.equals(unset);
    233241        if (httpOnly)
    234242            return "http://" + httpHost + ':' + httpPort + '/';
    235243        if (httpsHost.equals(unset))
    236             httpsHost = "127.0.0.1";
     244            return "http://" + DEFAULT_HOST + ':' + DEFAULT_CONSOLE_PORT + '/';
    237245        return "https://" + httpsHost + ':' + httpsPort + '/';
    238246    }
     
    250258            if (ia == null)
    251259                continue;
    252             out.write("<tr><td>" + s + "<td>" + convertWildcard(ia.getHostName(), "127.0.0.1") + "<td>" + ia.getPort() + '\n');
     260            out.write("<tr><td>" + s + "<td>" + convertWildcard(ia.getHostName(), DEFAULT_HOST) + "<td>" + ia.getPort() + '\n');
    253261        }
    254262        out.write("</table>\n");
Note: See TracChangeset for help on using the changeset viewer.