(String[] argv)
| 120 | } |
| 121 | |
| 122 | public static void main(String[] argv) { |
| 123 | |
| 124 | // during alpha period: expire after one week |
| 125 | Date builtOn = Common.getBuildDate(); |
| 126 | if (builtOn != null) { |
| 127 | long weekMillis = 1000 * 60 * 60 * 24 * 7; |
| 128 | Date expiry = new Date(builtOn.getTime() + weekMillis); |
| 129 | if (new Date().after(expiry)) { |
| 130 | System.err.println("Build expired on: " + expiry); |
| 131 | System.err |
| 132 | .println("Please obtain a more recent build for testing."); |
| 133 | System.exit(1); |
| 134 | } else { |
| 135 | System.err.println("Build will expire on: " + expiry); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // experimental tor support |
| 140 | boolean wantsTor = false; |
| 141 | for (String s : argv) { |
| 142 | if ("--tor".equals(s)) { |
| 143 | wantsTor = true; |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | if (wantsTor && !HAS_TOR) { |
| 148 | try { |
| 149 | log.info("Attempting to connect to tor network..."); |
| 150 | Security.addProvider(new BouncyCastleProvider()); |
| 151 | JvmGlobalUtil.init(); |
| 152 | NetLayer netLayer = NetFactory.getInstance().getNetLayerById( |
| 153 | NetLayerIDs.TOR); |
| 154 | JvmGlobalUtil.setNetLayerAndNetAddressNameService(netLayer, |
| 155 | true); |
| 156 | log.info("Connected to tor network"); |
| 157 | HAS_TOR = true; |
| 158 | } catch (Throwable t) { |
| 159 | log.error("Could not connect to tor: exiting", t); |
| 160 | System.exit(1); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // if unspecified, default relay to home.trsst.com |
| 165 | if (System.getProperty("com.trsst.server.relays") == null) { |
| 166 | System.setProperty("com.trsst.server.relays", |
| 167 | "https://home.trsst.com/feed"); |
| 168 | } |
| 169 | |
| 170 | // default to user-friendlier file names |
| 171 | String home = System.getProperty("user.home", "."); |
| 172 | if (System.getProperty("com.trsst.client.storage") == null) { |
| 173 | File client = new File(home, "Trsst Accounts"); |
| 174 | System.setProperty("com.trsst.client.storage", |
| 175 | client.getAbsolutePath()); |
| 176 | } |
| 177 | if (System.getProperty("com.trsst.server.storage") == null) { |
| 178 | File server = new File(home, "Trsst System Cache"); |
| 179 | System.setProperty("com.trsst.server.storage", |
nothing calls this directly
no test coverage detected