summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2023-08-10 08:51:29 -0700
committerBrad Fitzpatrick <brad@danga.com>2023-08-10 09:27:05 -0700
commit7a5263e6d008eb8fc26e987f9c66f94ffe5eedab (patch)
treeee40b436478ce2ac6cf7b4afecc9e9e7c3e7ca4d
parent3d56cafd7d23cd8ca09fa677f36cbfafec02f996 (diff)
downloadtailscale-7a5263e6d008eb8fc26e987f9c66f94ffe5eedab.tar.xz
tailscale-7a5263e6d008eb8fc26e987f9c66f94ffe5eedab.zip
util/linuxfw: rename ErrorFWModeNotSupported
Go style is for error variables to start with "err" (or "Err") and for error types to end in "Error". Updates #cleanup Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r--util/linuxfw/iptables.go2
-rw-r--r--util/linuxfw/linuxfw.go10
-rw-r--r--util/linuxfw/nftables.go4
3 files changed, 8 insertions, 8 deletions
diff --git a/util/linuxfw/iptables.go b/util/linuxfw/iptables.go
index 3b57b9c67..3cc612d03 100644
--- a/util/linuxfw/iptables.go
+++ b/util/linuxfw/iptables.go
@@ -49,7 +49,7 @@ func DetectIptables() (int, error) {
case err != nil && ip6err == nil:
allLines = ip6lines
default:
- return 0, ErrorFWModeNotSupported{
+ return 0, FWModeNotSupportedError{
Mode: FirewallModeIPTables,
Err: fmt.Errorf("iptables command run fail: %w", multierr.New(err, ip6err)),
}
diff --git a/util/linuxfw/linuxfw.go b/util/linuxfw/linuxfw.go
index 7a3bd02c0..e381e1f52 100644
--- a/util/linuxfw/linuxfw.go
+++ b/util/linuxfw/linuxfw.go
@@ -29,21 +29,21 @@ const (
Masq
)
-type ErrorFWModeNotSupported struct {
+type FWModeNotSupportedError struct {
Mode FirewallMode
Err error
}
-func (e ErrorFWModeNotSupported) Error() string {
+func (e FWModeNotSupportedError) Error() string {
return fmt.Sprintf("firewall mode %q not supported: %v", e.Mode, e.Err)
}
-func (e ErrorFWModeNotSupported) Is(target error) bool {
- _, ok := target.(ErrorFWModeNotSupported)
+func (e FWModeNotSupportedError) Is(target error) bool {
+ _, ok := target.(FWModeNotSupportedError)
return ok
}
-func (e ErrorFWModeNotSupported) Unwrap() error {
+func (e FWModeNotSupportedError) Unwrap() error {
return e.Err
}
diff --git a/util/linuxfw/nftables.go b/util/linuxfw/nftables.go
index 6a462a890..afe6dfa6e 100644
--- a/util/linuxfw/nftables.go
+++ b/util/linuxfw/nftables.go
@@ -107,7 +107,7 @@ func DebugNetfilter(logf logger.Logf) error {
func DetectNetfilter() (int, error) {
conn, err := nftables.New()
if err != nil {
- return 0, ErrorFWModeNotSupported{
+ return 0, FWModeNotSupportedError{
Mode: FirewallModeNfTables,
Err: err,
}
@@ -115,7 +115,7 @@ func DetectNetfilter() (int, error) {
chains, err := conn.ListChains()
if err != nil {
- return 0, ErrorFWModeNotSupported{
+ return 0, FWModeNotSupportedError{
Mode: FirewallModeNfTables,
Err: fmt.Errorf("cannot list chains: %w", err),
}