more fixes

This commit is contained in:
Quentin McGaw
2026-08-07 11:32:24 +00:00
parent 2697b4422f
commit 3d76b14224
5 changed files with 7 additions and 19 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
FROM ghcr.io/qdm12/godevcontainer:v0.21-alpine
FROM ghcr.io/qdm12/godevcontainer:v0.22-alpine
RUN apk add wireguard-tools htop openssl tcpdump iptables nftables
RUN apk add nodejs npm && npm install markdownlint-cli2 --global && apk del npm
+1 -1
View File
@@ -83,7 +83,7 @@ func (f *Firewall) overrideWith(other Firewall) {
func (f *Firewall) setDefaults(globalLogLevel string) {
f.Enabled = gosettings.DefaultPointer(f.Enabled, true)
f.Implementation = gosettings.DefaultComparable(f.Implementation, "iptables")
f.Implementation = gosettings.DefaultComparable(f.Implementation, "auto")
f.Iptables.setDefaults(globalLogLevel)
}
@@ -62,7 +62,7 @@ func Test_Settings_String(t *testing.T) {
| └── Block ads: no
├── Firewall settings:
| ├── Enabled: yes
| ├── Implementation: iptables
| ├── Implementation: auto
| └── Iptables settings:
| └── Log level: INFO
├── Log settings:
-15
View File
@@ -3,8 +3,6 @@ package iptables
import (
"context"
"sync"
"github.com/qdm12/gluetun/internal/mod"
)
type Config struct {
@@ -15,8 +13,6 @@ type Config struct {
// Fixed state
ipTables string
ip6Tables string
nftables bool
xtMark bool
}
func New(ctx context.Context, runner CmdRunner, logger Logger) (*Config, error) {
@@ -30,21 +26,10 @@ func New(ctx context.Context, runner CmdRunner, logger Logger) (*Config, error)
return nil, err
}
modules := map[string]bool{
"xt_mark": false,
"nf_tables": false,
}
for module := range modules {
err := mod.Probe(module)
modules[module] = err == nil
}
return &Config{
runner: runner,
logger: logger,
ipTables: iptables,
ip6Tables: ip6tables,
nftables: modules["nf_tables"],
xtMark: modules["xt_mark"],
}, nil
}
+3 -1
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/netip"
"os"
)
type tcpFlags struct {
@@ -71,7 +72,8 @@ func (c *Config) TempDropOutputTCPRST(ctx context.Context,
src, dst netip.AddrPort, excludeMark int) (
revert func(ctx context.Context) error, err error,
) {
if !c.nftables && !c.xtMark {
_, err = os.Stat("/usr/lib/xtables/libxt_mark.so")
if err != nil && errors.Is(err, os.ErrNotExist) {
return nil, fmt.Errorf("%w", ErrMarkMatchModuleMissing)
}