-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from hannesm/fix-example
move to MirageOS3: pretty print errors, fix discard (to react properl…
- Loading branch information
Showing
3 changed files
with
31 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
open Mirage | ||
|
||
let main = foreign "Services.Main" (console @-> stackv4 @-> job) | ||
let main = foreign "Services.Main" (stackv4 @-> job) | ||
|
||
let net = | ||
try match Sys.getenv "NET" with | ||
| "direct" -> `Direct | ||
| "socket" -> `Socket | ||
| _ -> `Direct | ||
with Not_found -> `Direct | ||
|
||
let dhcp = | ||
try match Sys.getenv "ADDR" with | ||
| "dhcp" -> `Dhcp | ||
| "static" -> `Static | ||
| _ -> `Dhcp | ||
with Not_found -> `Dhcp | ||
|
||
let stack console = | ||
match net, dhcp with | ||
| `Direct, `Dhcp -> direct_stackv4_with_dhcp console tap0 | ||
| `Direct, `Static -> direct_stackv4_with_default_ipv4 console tap0 | ||
| `Socket, _ -> socket_stackv4 console [Ipaddr.V4.any] | ||
let stack = generic_stackv4 default_network | ||
|
||
let () = | ||
register "services" [ | ||
main $ default_console $ stack default_console | ||
main $ stack | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters