Maint: pass only single strings to logger methods

- Do not assume formatting from logger's interface
- Allow to change golibs in the future to accept only strings for logger methods
This commit is contained in:
Quentin McGaw (desktop)
2021-07-23 17:36:08 +00:00
parent 21f4cf7ab5
commit 3c44214d01
34 changed files with 134 additions and 127 deletions

View File

@@ -37,7 +37,7 @@ func (c *configurator) removeOutboundSubnets(ctx context.Context, subnets []net.
const remove = true
for _, subnet := range subnets {
if err := c.acceptOutputFromIPToSubnet(ctx, c.defaultInterface, c.localIP, subnet, remove); err != nil {
c.logger.Error("cannot remove outdated outbound subnet through firewall: %s", err)
c.logger.Error("cannot remove outdated outbound subnet through firewall: " + err.Error())
continue
}
c.outboundSubnets = removeSubnetFromSubnets(c.outboundSubnets, subnet)

View File

@@ -3,6 +3,7 @@ package firewall
import (
"context"
"fmt"
"strconv"
)
func (c *configurator) SetAllowedPort(ctx context.Context, port uint16, intf string) (err error) {
@@ -19,7 +20,7 @@ func (c *configurator) SetAllowedPort(ctx context.Context, port uint16, intf str
return nil
}
c.logger.Info("setting allowed input port %d through interface %s...", port, intf)
c.logger.Info("setting allowed input port " + fmt.Sprint(port) + " through interface " + intf + "...")
if existingIntf, ok := c.allowedInputPorts[port]; ok {
if intf == existingIntf {
@@ -54,7 +55,7 @@ func (c *configurator) RemoveAllowedPort(ctx context.Context, port uint16) (err
return nil
}
c.logger.Info("removing allowed port %d through firewall...", port)
c.logger.Info("removing allowed port "+strconv.Itoa(int(port))+" through firewall...", port)
intf, ok := c.allowedInputPorts[port]
if !ok {

View File

@@ -26,7 +26,7 @@ func (c *configurator) SetVPNConnection(ctx context.Context, connection models.O
remove := true
if c.vpnConnection.IP != nil {
if err := c.acceptOutputTrafficToVPN(ctx, c.defaultInterface, c.vpnConnection, remove); err != nil {
c.logger.Error("cannot remove outdated VPN connection through firewall: %s", err)
c.logger.Error("cannot remove outdated VPN connection through firewall: " + err.Error())
}
}
c.vpnConnection = models.OpenVPNConnection{}