Documentation ¶
Overview ¶
gokrazy packs your Go application(s) into an SD card image for the Raspberry Pi 3 which — aside from the Linux kernel and proprietary Raspberry Pi bootloader — only contains Go software.
Boot and Supervise are called by the auto-generated init program. They are provided in case you need to implement a custom init program.
PrivateInterfaceAddrs is useful for init and other processes.
DontStartOnBoot and WaitForClock are useful for non-init processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PrivateNetworks = []string{
"127.0.0.0/8",
"::1/128",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"fc00::/7",
"169.254.0.0/16",
"fe80::/10",
}
PrivateNetworks contains the CIDR representation of all networks which gokrazy considers private.
Functions ¶
func Boot ¶
Boot configures basic system settings. More specifically, it:
- mounts /dev, /tmp, /proc, /sys and /perm file systems
- mounts and populate /etc tmpfs overlay
- sets hostname from the /etc/hostname file
- sets HTTP password from the gokr-pw.txt file
- configures the loopback network interface
Boot should always be called to transition the machine into a useful state, even in custom init process implementations or single-process applications.
userBuildTimestamp will be exposed on the HTTP status handlers that are set up by Supervise.
func DontStartOnBoot ¶
func DontStartOnBoot()
DontStartOnBoot informs the gokrazy init process to not supervise the process and exits. The user can manually start supervision, which turns DontStartOnBoot into a no-op.
func IsInPrivateNet ¶
IsInPrivateNet reports whether ip is in PrivateNetworks.
func Model ¶
func Model() string
Model returns a human readable description of the current device model, e.g. “Raspberry Pi 4 Model B Rev 1.1” or “PC Engines apu2”.
func PrivateInterfaceAddrs ¶
PrivateInterfaceAddrs returns all private (as per RFC1918, RFC4193, RFC3330, RFC3513, RFC3927, RFC4291) host addresses of all active interfaces, suitable to be passed to net.JoinHostPort.
func PublicInterfaceAddrs ¶
PublicInterfaceAddrs returns all public (excluding RFC1918, RFC4193, RFC3330, RFC3513, RFC3927, RFC4291) host addresses of all active interfaces, suitable to be passed to net.JoinHostPort.
func Supervise ¶
Supervise continuously restarts the processes specified in commands unless they run DontStartOnBoot.
Password-protected HTTP handlers are installed, allowing to inspect the supervised services and update the gokrazy installation over the network.
HTTP is served on PrivateInterfaceAddrs(). New IP addresses will be picked up upon receiving SIGHUP.
func WaitForClock ¶
func WaitForClock()
WaitForClock returns once the system clock appears to have been set. Assumes that the system boots with a clock value of January 1, 1970 UTC (UNIX epoch), as is the case on the Raspberry Pi 3.
Types ¶
This section is empty.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
dhcp
dhcp is a minimal DHCP client for gokrazy.
|
dhcp is a minimal DHCP client for gokrazy. |
ntp
ntp is a minimal NTP client for gokrazy.
|
ntp is a minimal NTP client for gokrazy. |
randomd
Binary randomd carries entropy across restarts.
|
Binary randomd carries entropy across restarts. |
Package empty is pulled in only for the side-effect of checking out the gokrazy git repository.
|
Package empty is pulled in only for the side-effect of checking out the gokrazy git repository. |
internal
|
|
teelogger
Package teelogger provides loggers which send their output to multiple writers, like the tee(1) command.
|
Package teelogger provides loggers which send their output to multiple writers, like the tee(1) command. |