MAC vendor lookup: Difference between revisions
→{{header|Wren}}: Tweaks to fit the task requirements more closely.
(Added Wren) |
(→{{header|Wren}}: Tweaks to fit the task requirements more closely.) |
||
Line 984:
}
System.print(MAC.lookup("FC:FB:FB:01:FA:21"))
for (i in 1..1e8) {} // slow down request
System.print(MAC.lookup("23:45:67"))</lang>
which we embed in the following Go program and run it.
Line 1,001 ⟶ 1,003:
func macLookup(vm *wren.VM, parameters []any) (any, error) {
mac := parameters[1].(string)
resp,
if err != nil {
body, _ := ioutil.ReadAll(resp.Body)▼
return
}
if err != nil {
return nil, nil
}
var vendor = string(body)
if vendor == `{"errors":{"detail":"Not Found"}}` {
return "N/A", nil
}
return vendor, nil
}
func main() {
Line 1,020 ⟶ 1,032:
<pre>
Cisco Systems, Inc
N/A
</pre>
|