35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package common
|
|
|
|
import (
|
|
`os`
|
|
`syscall`
|
|
`time`
|
|
)
|
|
|
|
const (
|
|
/*
|
|
DefaultTimePeriod is the default time period for TOTP.
|
|
|
|
See [RFC 6238 § 4.1], [RFC 6238 § 4.1], [RFC 6238 § 6], and [RFC 6238 Appendix A].
|
|
|
|
[RFC 6238 § 4.1]: https://datatracker.ietf.org/doc/html/rfc6238#section-4.1
|
|
[RFC 6238 § 5.2]: https://datatracker.ietf.org/doc/html/rfc6238#section-5.2
|
|
[RFC 6238 § 6]: https://datatracker.ietf.org/doc/html/rfc6238#section-6
|
|
[RFC 6238 Appendix A]: https://datatracker.ietf.org/doc/html/rfc6238#appendix-A
|
|
*/
|
|
DefaultTimePeriod time.Duration = time.Second * 30
|
|
|
|
// VaultRepl is used to replace any invalid characters in a name.
|
|
VaultRepl rune = '_'
|
|
)
|
|
|
|
var (
|
|
// ProgEndSigs are used to trap signals and gracefully quit. Note that these don't really have a Windows equivalent.
|
|
ProgEndSigs []os.Signal = []os.Signal{
|
|
os.Interrupt, // SIGINT, signal 2 (ctrl+c)
|
|
syscall.SIGQUIT, // signal 3 (ctrl + \\) (SIGINT but with coredump)
|
|
os.Kill, // SIGKILL, signal 9 (useless to capture since the program can't ignore/trap it)
|
|
syscall.SIGTERM, // signal 15 (`kill` default)
|
|
}
|
|
)
|