static TimedCache<L<S>> detectGateways_cache = new TimedCache(5); static synchronized L<S> detectGateways() ctex { if (detectGateways_cache.has()) ret detectGateways_cache.getNoClean(); boolean win = isWindows(); String s = backtick(win ? "ipconfig" : "ip route show"); new TreeSet<S> ips; for (String line : toLines(s)) if (indexOfIgnoreCase(line, win ? "Gateway" : "via") >= 0) ips.addAll(regexpAll("\\d+\\.\\d+\\.\\d+\\.\\d+", line)); return detectGateways_cache.set(new ArrayList<S>(ips)); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001179 |
Snippet name: | detectGateways |
Eternal ID of this version: | #1001179/1 |
Text MD5: | a2e464117eed5a2d303e14c05c2feb4b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-16 15:53:55 |
Source code size: | 531 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 655 / 936 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |