MCPcopy Create free account
hub / github.com/apache/mesos / defaultGateway

Function defaultGateway

src/linux/routing/route.cpp:121–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120
121Result<net::IP> defaultGateway()
122{
123 Try<vector<Rule>> rules = table();
124 if (rules.isError()) {
125 return Error("Failed to get the routing table: " + rules.error());
126 }
127
128 foreach (const Rule& rule, rules.get()) {
129 if (rule.destination.isNone() && rule.gateway.isSome()) {
130 return rule.gateway.get();
131 }
132 }
133
134 return None();
135}
136
137} // namespace route {
138} // namespace routing {

Callers 2

TEST_FFunction · 0.85
createMethod · 0.85

Calls 5

tableFunction · 0.85
NoneClass · 0.85
errorMethod · 0.65
ErrorFunction · 0.50
isErrorMethod · 0.45

Tested by 1

TEST_FFunction · 0.68