diff options
| author | Shulhan <ms@kilabit.info> | 2026-02-02 15:16:01 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-02-02 16:28:11 +0700 |
| commit | 23c576b28ac9bd180155e99f5f07f9d0bac3436e (patch) | |
| tree | 6eab625a6ed136a7c7016ad1370ebd60d1ca0f2f /lib/systemd/testdata/cmd/daemonTCP/main.go | |
| parent | bebcc50aa6fcaf13c4cbb2116e73d107bc7d9576 (diff) | |
| download | pakakeh.go-23c576b28ac9bd180155e99f5f07f9d0bac3436e.tar.xz | |
lib/systemd: new package for socket-based activation
The `lib/systemd` package implement function `Listeners` that return list
of file descriptor as [net.Listener], that enable program to run with
systemd.socket(5) based activation.
Diffstat (limited to 'lib/systemd/testdata/cmd/daemonTCP/main.go')
| -rw-r--r-- | lib/systemd/testdata/cmd/daemonTCP/main.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/systemd/testdata/cmd/daemonTCP/main.go b/lib/systemd/testdata/cmd/daemonTCP/main.go new file mode 100644 index 00000000..e667d8a0 --- /dev/null +++ b/lib/systemd/testdata/cmd/daemonTCP/main.go @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2026 M. Shulhan <ms@kilabit.info> + +package main + +import ( + "fmt" + "log" + + "git.sr.ht/~shulhan/pakakeh.go/lib/systemd" +) + +func main() { + lns, err := systemd.Listeners(true) + if err != nil { + log.Fatal(err) + } + for _, ln := range lns { + fmt.Printf(`listener network address: %s`, ln.Addr()) + } +} |
