| 89 | |
| 90 | |
| 91 | Result<string> lo() |
| 92 | { |
| 93 | Try<set<string>> links = net::links(); |
| 94 | if (links.isError()) { |
| 95 | return Error("Failed to get all the links: " + links.error()); |
| 96 | } |
| 97 | |
| 98 | foreach (const string& link, links.get()) { |
| 99 | Result<bool> test = link::internal::test(link, IFF_LOOPBACK); |
| 100 | if (test.isError()) { |
| 101 | return Error("Failed to check the flag on link: " + link); |
| 102 | } else if (test.isSome() && test.get()) { |
| 103 | return link; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return None(); |
| 108 | } |
| 109 | |
| 110 | |
| 111 | Try<bool> exists(const string& _link) |