goutmp/README.md

36 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2018-06-27 22:24:11 +00:00
goutmp - Minimal bindings to C stdlib pututmpx(), getutmpx() (/var/log/wtmp) and /var/log/lastlog
Any Go program which allows user shell access should update the standard UNIX files which track user sessions: /var/log/wtmp (for the 'w' and 'who' commands), and /var/log/lastlog (the 'last' and 'lastlog' commands).
2018-06-27 22:27:12 +00:00
```
2023-02-03 03:01:13 +00:00
$ go doc -all
2018-06-27 22:24:11 +00:00
package goutmp // import "blitter.com/go/goutmp"
Golang bindings for basic login/utmp accounting
2023-02-03 03:01:13 +00:00
FUNCTIONS
func GetHost(addr string) (h string)
return remote client hostname or IP if host lookup fails addr is expected to
be of the format given by net.Addr.String() eg., "127.0.0.1:80" or
"[::1]:80"
2018-06-27 22:27:12 +00:00
2019-07-06 07:23:16 +00:00
func Put_lastlog_entry(app, usr, ptsname, host string)
2023-02-03 03:01:13 +00:00
Put the login app, username and originating host/IP to lastlog
2018-06-27 22:24:11 +00:00
func Unput_utmp(entry UtmpEntry)
2023-02-03 03:01:13 +00:00
Remove a username/host entry from utmp
TYPES
type UtmpEntry struct {
// Has unexported fields.
}
UtmpEntry wraps the C struct utmp
func Put_utmp(user, ptsName, host string) UtmpEntry
Put a username and the originating host/IP to utmp
2018-06-27 22:27:12 +00:00
```
2018-06-27 22:24:11 +00:00