1 | static TimedCache<L<S>> detectGateways_cache = new TimedCache(5); |
2 | |
3 | static synchronized L<S> detectGateways() ctex { |
4 | if (detectGateways_cache.has()) ret detectGateways_cache.getNoClean(); |
5 | |
6 | boolean win = isWindows(); |
7 | String s = backtick(win ? "ipconfig" : "ip route show"); |
8 | new TreeSet<S> ips; |
9 | for (String line : toLines(s)) |
10 | if (indexOfIgnoreCase(line, win ? "Gateway" : "via") >= 0) |
11 | ips.addAll(regexpAll("\\d+\\.\\d+\\.\\d+\\.\\d+", line)); |
12 | return detectGateways_cache.set(new ArrayList<S>(ips)); |
13 | } |
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: | 656 / 937 |
Referenced in: | [show references] |