mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:54:40 +03:00
mox!
This commit is contained in:
18
mox-/setcaphint.go
Normal file
18
mox-/setcaphint.go
Normal file
@ -0,0 +1,18 @@
|
||||
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 ""
|
||||
}
|
Reference in New Issue
Block a user