From 2a33d64abc6b161229a534f3380597d25424c806 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Fri, 13 Feb 2026 00:28:14 +0800 Subject: [PATCH] Fix logging maybe panic --- tun_linux.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tun_linux.go b/tun_linux.go index 8e1e5d5..ac36af2 100644 --- a/tun_linux.go +++ b/tun_linux.go @@ -148,7 +148,9 @@ func (t *NativeTun) configure(tunLink netlink.Link) error { if t.options.GSO { err = t.enableGSO() if err != nil { - t.options.Logger.Warn(err) + if t.options.Logger != nil { + t.options.Logger.Warn(err) + } } } @@ -275,7 +277,9 @@ func (t *NativeTun) Start() error { if err != nil { t.gro.disableTCPGRO() t.gro.disableUDPGRO() - t.options.Logger.Warn(E.Cause(err, "disabled TUN TCP & UDP GRO due to GRO probe error")) + if t.options.Logger != nil { + t.options.Logger.Warn(E.Cause(err, "disabled TUN TCP & UDP GRO due to GRO probe error")) + } } }