Changeset ae50599 for core


Ignore:
Timestamp:
Jan 18, 2018 1:25:21 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2f4ea9c5
Parents:
109ac5b
Message:

Util: Consolidate console URL generation in PortMapper?

File:
1 edited

Legend:

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

    r109ac5b rae50599  
    174174    }
    175175
     176    /*
     177     *  @return http URL unless console is https only. Default http://127.0.0.1:7657/
     178     *  @since 0.9.33 consolidated from i2ptunnel and desktopgui
     179     */
     180    public String getConsoleURL() {
     181        String unset = "*unset*";
     182        String httpHost = getActualHost(SVC_CONSOLE, unset);
     183        String httpsHost = getActualHost(SVC_HTTPS_CONSOLE, unset);
     184        int httpPort = getPort(SVC_CONSOLE, 7657);
     185        int httpsPort = getPort(SVC_HTTPS_CONSOLE, -1);
     186        boolean httpsOnly = httpsPort > 0 && httpHost.equals(unset) && !httpsHost.equals(unset);
     187        if (httpsOnly)
     188            return "https://" + httpsHost + ':' + httpsPort + '/';
     189        if (httpHost.equals(unset))
     190            httpHost = "127.0.0.1";
     191        return "http://" + httpHost + ':' + httpPort + '/';
     192    }
     193
    176194    /**
    177195     *  For debugging only
Note: See TracChangeset for help on using the changeset viewer.