mox/mox-/setcaphint.go
Mechiel Lukkien cb229cb6cf
mox!
2023-01-30 14:27:06 +01:00

18 lines
488 B
Go

package mox
import (
"errors"
"os"
"runtime"
)
// todo: perhaps find and document the recommended way to get this on other platforms?
// LinuxSetcapHint returns a hint about using setcap for binding to privileged
// ports, only if relevant the error and GOOS (Linux).
func LinuxSetcapHint(err error) string {
if runtime.GOOS == "linux" && errors.Is(err, os.ErrPermission) {
return " (privileged port? try again after: sudo setcap 'cap_net_bind_service=+ep' mox)"
}
return ""
}