From ce8e1d16b4807a27ebacc2f144cc3b5dce705d67 Mon Sep 17 00:00:00 2001 From: Poorunga <2744323@qq.com> Date: Sat, 25 Nov 2023 17:12:10 +0800 Subject: [PATCH] lint code --- build/agent/Dockerfile | 2 +- build/gateway/Dockerfile | 2 +- cmd/edgemesh-cni/cmd/command_add.go | 4 ++-- cmd/edgemesh-cni/cmd/command_del.go | 2 +- cmd/edgemesh-cni/main.go | 2 +- pkg/apis/config/v1alpha1/default.go | 4 ++-- pkg/dns/corefile.go | 3 +-- pkg/dns/dns.go | 1 - pkg/gateway/gateway.go | 2 +- pkg/gateway/http.go | 4 ++-- pkg/gateway/http_test.go | 6 +++--- pkg/gateway/server.go | 3 +-- pkg/loadbalancer/hashring.go | 2 +- pkg/loadbalancer/loadbalancer.go | 5 +++-- pkg/loadbalancer/policy.go | 20 ++++++++++---------- pkg/proxy/module.go | 2 +- pkg/proxy/proxysocket.go | 4 ++-- pkg/proxy/server.go | 12 ++++++------ pkg/proxy/socks5_proxy.go | 6 +++--- pkg/tunnel/limit.go | 6 +++--- pkg/util/net/conn.go | 4 ++-- pkg/util/tunutils/ipframe.go | 16 ++++++++-------- pkg/util/tunutils/ipframe_test.go | 4 ++-- pkg/util/tunutils/tun.go | 6 +++--- 24 files changed, 60 insertions(+), 62 deletions(-) diff --git a/build/agent/Dockerfile b/build/agent/Dockerfile index 1c44debc5..554ec982a 100644 --- a/build/agent/Dockerfile +++ b/build/agent/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:1.19 AS builder ARG GO_LDFLAGS ARG TARGETARCH diff --git a/build/gateway/Dockerfile b/build/gateway/Dockerfile index a656063d0..b0ef3adfa 100644 --- a/build/gateway/Dockerfile +++ b/build/gateway/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:1.19 AS builder ARG GO_LDFLAGS ARG TARGETARCH diff --git a/cmd/edgemesh-cni/cmd/command_add.go b/cmd/edgemesh-cni/cmd/command_add.go index d2550fae8..6f7d29ca1 100644 --- a/cmd/edgemesh-cni/cmd/command_add.go +++ b/cmd/edgemesh-cni/cmd/command_add.go @@ -10,8 +10,8 @@ import ( "k8s.io/klog/v2" ) -// CmdAdd TODO: file log -func CmdAdd(args *skel.CmdArgs) (err error) { +// Add TODO: file log +func Add(args *skel.CmdArgs) (err error) { defer func() { if e := recover(); e != nil { msg := fmt.Sprintf("EdgeMesh CNI panicked during ADD: %s", e) diff --git a/cmd/edgemesh-cni/cmd/command_del.go b/cmd/edgemesh-cni/cmd/command_del.go index 41a82eb76..30bcfb1cb 100644 --- a/cmd/edgemesh-cni/cmd/command_del.go +++ b/cmd/edgemesh-cni/cmd/command_del.go @@ -11,7 +11,7 @@ import ( ) // TODO: file log -func CmdDel(args *skel.CmdArgs) (err error) { +func Del(args *skel.CmdArgs) (err error) { defer func() { if e := recover(); e != nil { msg := fmt.Sprintf("EdgeMesh CNI panicked during DEL: %s", e) diff --git a/cmd/edgemesh-cni/main.go b/cmd/edgemesh-cni/main.go index f3377e123..c0f268b0e 100644 --- a/cmd/edgemesh-cni/main.go +++ b/cmd/edgemesh-cni/main.go @@ -12,5 +12,5 @@ var ( ) func main() { - skel.PluginMain(cmd.CmdAdd, nil, cmd.CmdDel, cni.All, "EdgeMesh CNI plugin "+version) + skel.PluginMain(cmd.Add, nil, cmd.Del, cni.All, "EdgeMesh CNI plugin "+version) } diff --git a/pkg/apis/config/v1alpha1/default.go b/pkg/apis/config/v1alpha1/default.go index 0b4f98aea..f7964e3be 100644 --- a/pkg/apis/config/v1alpha1/default.go +++ b/pkg/apis/config/v1alpha1/default.go @@ -40,7 +40,7 @@ var defaultLoadBalancerConfig = &LoadBalancer{ }, } -func newDefaultEdgeCNIConfig(configPath string) *EdgeCNIConfig { +func newDefaultEdgeCNIConfig() *EdgeCNIConfig { return &EdgeCNIConfig{ Enable: false, } @@ -131,7 +131,7 @@ func NewDefaultEdgeMeshAgentConfig(configPath string) *EdgeMeshAgentConfig { LoadBalancer: defaultLoadBalancerConfig, }, EdgeTunnelConfig: newDefaultEdgeTunnelConfig(configPath), - EdgeCNIConfig: newDefaultEdgeCNIConfig(configPath), + EdgeCNIConfig: newDefaultEdgeCNIConfig(), }, } diff --git a/pkg/dns/corefile.go b/pkg/dns/corefile.go index b6e43319b..bd198e06e 100644 --- a/pkg/dns/corefile.go +++ b/pkg/dns/corefile.go @@ -147,9 +147,8 @@ func UpdateCorefile(cfg *v1alpha1.EdgeDNSConfig, kubeClient kubernetes.Interface upstreamServers = removeDuplicate(upstreamServers) if len(upstreamServers) == 0 { return fmt.Errorf("failed to get nodelocal dns upstream servers") - } else { - klog.Infof("nodelocal dns upstream servers: %v", upstreamServers) } + klog.Infof("nodelocal dns upstream servers: %v", upstreamServers) cacheTTL = cfg.CacheDNS.CacheTTL // disable coredns kubernetes plugin. kubernetesPlugin = "" diff --git a/pkg/dns/dns.go b/pkg/dns/dns.go index 005f74d25..856017c84 100644 --- a/pkg/dns/dns.go +++ b/pkg/dns/dns.go @@ -5,7 +5,6 @@ import ( "github.com/coredns/caddy" "github.com/coredns/coredns/coremain" - // blank imports to make sure the plugin code is pulled in from vendor _ "github.com/coredns/coredns/plugin/bind" _ "github.com/coredns/coredns/plugin/cache" diff --git a/pkg/gateway/gateway.go b/pkg/gateway/gateway.go index d29d15f79..a60d07102 100644 --- a/pkg/gateway/gateway.go +++ b/pkg/gateway/gateway.go @@ -108,7 +108,7 @@ func (gw *EdgeGateway) OnGatewayAdd(gateway *istiv1alpha3.Gateway) { } // OnGatewayUpdate update a gateway server -func (gw *EdgeGateway) OnGatewayUpdate(oldGateway, gateway *istiv1alpha3.Gateway) { +func (gw *EdgeGateway) OnGatewayUpdate(_, gateway *istiv1alpha3.Gateway) { gw.lock.Lock() defer gw.lock.Unlock() diff --git a/pkg/gateway/http.go b/pkg/gateway/http.go index 09f9f64f2..1b023d41e 100644 --- a/pkg/gateway/http.go +++ b/pkg/gateway/http.go @@ -63,14 +63,14 @@ func (p *HTTP) Process() { } // passthrough - httpToTcp := &TCP{ + httpToTCP := &TCP{ Conn: p.Conn, SvcNamespace: p.SvcNamespace, SvcName: p.SvcName, SvcPort: p.SvcPort, UpgradeReq: req, } - httpToTcp.Process() + httpToTCP.Process() } } diff --git a/pkg/gateway/http_test.go b/pkg/gateway/http_test.go index b4cbf2262..46c49a3a2 100644 --- a/pkg/gateway/http_test.go +++ b/pkg/gateway/http_test.go @@ -15,16 +15,16 @@ func TestUriMatch(t *testing.T) { {MatchType: &networkingv1alpha3.StringMatch_Prefix{Prefix: "/hello*"}}, {MatchType: &networkingv1alpha3.StringMatch_Prefix{Prefix: "/)(j3*a0"}}, } - reqUris := []string{ + reqURIs := []string{ "/", "/abc", "/abcd", "/xyz", "/hello-world", } - for _, reqUri := range reqUris { + for _, reqURI := range reqURIs { for _, uriRule := range uriRules { - t.Log(uriMatch(uriRule, reqUri)) + t.Log(uriMatch(uriRule, reqURI)) } } } diff --git a/pkg/gateway/server.go b/pkg/gateway/server.go index 7788e9967..51c5c33d3 100644 --- a/pkg/gateway/server.go +++ b/pkg/gateway/server.go @@ -193,9 +193,8 @@ func (srv *Server) newProto(conn net.Conn) (Protocol, error) { } } return nil, fmt.Errorf("no match virtual service") - } else { - return nil, fmt.Errorf("protocol %s not supported", srv.options.Protocol) } + return nil, fmt.Errorf("protocol %s not supported", srv.options.Protocol) } return nil, fmt.Errorf("egress traffic not supported") } diff --git a/pkg/loadbalancer/hashring.go b/pkg/loadbalancer/hashring.go index 358cc80ac..01bd03e47 100644 --- a/pkg/loadbalancer/hashring.go +++ b/pkg/loadbalancer/hashring.go @@ -110,7 +110,7 @@ func getConsistentHashKey(dr *istioapi.DestinationRule) HashKey { } switch consistentHashLb := lbPolicy.ConsistentHash.HashKey.(type) { case *istiov1alpha3.LoadBalancerSettings_ConsistentHashLB_HttpHeaderName: - return HashKey{Type: HttpHeader, Key: consistentHashLb.HttpHeaderName} + return HashKey{Type: HTTPHeader, Key: consistentHashLb.HttpHeaderName} case *istiov1alpha3.LoadBalancerSettings_ConsistentHashLB_HttpCookie: klog.Errorf("http cookie is not supported as a hash key") return HashKey{} diff --git a/pkg/loadbalancer/loadbalancer.go b/pkg/loadbalancer/loadbalancer.go index 4613fea5d..6400e996a 100644 --- a/pkg/loadbalancer/loadbalancer.go +++ b/pkg/loadbalancer/loadbalancer.go @@ -326,7 +326,7 @@ func (lb *LoadBalancer) OnServiceAdd(service *v1.Service) { lb.cleanupStaleStickySessions() } -func (lb *LoadBalancer) OnServiceUpdate(oldService, service *v1.Service) { +func (lb *LoadBalancer) OnServiceUpdate(_, service *v1.Service) { lb.mu.Lock() defer lb.mu.Unlock() @@ -689,7 +689,7 @@ func (lb *LoadBalancer) TryConnectEndpoints(service proxy.ServicePortName, srcAd continue } if req != nil { - reqBytes, err := netutil.HttpRequestToBytes(req) + reqBytes, err := netutil.HTTPRequestToBytes(req) if err == nil { _, err = outConn.Write(reqBytes) if err != nil { @@ -735,6 +735,7 @@ func (lb *LoadBalancer) dialEndpoint(protocol, endpoint string) (net.Conn, error } func (lb *LoadBalancer) NextEndpoint(svcPort proxy.ServicePortName, srcAddr net.Addr, sessionAffinityReset bool) (string, error) { + klog.V(4).InfoS("", svcPort, srcAddr, sessionAffinityReset) return "", nil } diff --git a/pkg/loadbalancer/policy.go b/pkg/loadbalancer/policy.go index 22d69d832..45f689104 100644 --- a/pkg/loadbalancer/policy.go +++ b/pkg/loadbalancer/policy.go @@ -20,7 +20,7 @@ const ( Random = "RANDOM" ConsistentHash = "CONSISTENT_HASH" - HttpHeader = "HTTP_HEADER" + HTTPHeader = "HTTP_HEADER" UserSourceIP = "USER_SOURCE_IP" ) @@ -44,15 +44,15 @@ func (*RoundRobinPolicy) Name() string { return RoundRobin } -func (*RoundRobinPolicy) Update(oldDr, dr *istioapi.DestinationRule) {} +func (*RoundRobinPolicy) Update(_, _ *istioapi.DestinationRule) {} -func (*RoundRobinPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (string, *http.Request, error) { +func (*RoundRobinPolicy) Pick(_ []string, _ net.Addr, _ net.Conn, cliReq *http.Request) (string, *http.Request, error) { // RoundRobinPolicy is an empty implementation and we won't use it, // the outer round-robin policy will be used next. return "", cliReq, fmt.Errorf("call RoundRobinPolicy is forbidden") } -func (*RoundRobinPolicy) Sync(endpoints []string) {} +func (*RoundRobinPolicy) Sync(_ []string) {} func (*RoundRobinPolicy) Release() {} @@ -68,16 +68,16 @@ func (rd *RandomPolicy) Name() string { return Random } -func (rd *RandomPolicy) Update(oldDr, dr *istioapi.DestinationRule) {} +func (rd *RandomPolicy) Update(_, _ *istioapi.DestinationRule) {} -func (rd *RandomPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (string, *http.Request, error) { +func (rd *RandomPolicy) Pick(endpoints []string, _ net.Addr, _ net.Conn, cliReq *http.Request) (string, *http.Request, error) { rd.lock.Lock() k := rand.Int() % len(endpoints) rd.lock.Unlock() return endpoints[k], cliReq, nil } -func (rd *RandomPolicy) Sync(endpoints []string) {} +func (rd *RandomPolicy) Sync(_ []string) {} func (rd *RandomPolicy) Release() {} @@ -100,20 +100,20 @@ func (ch *ConsistentHashPolicy) Name() string { return ConsistentHash } -func (ch *ConsistentHashPolicy) Update(oldDr, dr *istioapi.DestinationRule) { +func (ch *ConsistentHashPolicy) Update(_, dr *istioapi.DestinationRule) { ch.lock.Lock() ch.hashKey = getConsistentHashKey(dr) ch.lock.Unlock() } -func (ch *ConsistentHashPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (endpoint string, req *http.Request, err error) { +func (ch *ConsistentHashPolicy) Pick(_ []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (endpoint string, req *http.Request, err error) { ch.lock.Lock() defer ch.lock.Unlock() req = cliReq var keyValue string switch ch.hashKey.Type { - case HttpHeader: + case HTTPHeader: if req == nil { req, err = http.ReadRequest(bufio.NewReader(netConn)) if err != nil { diff --git a/pkg/proxy/module.go b/pkg/proxy/module.go index 96c5ec7aa..ee1429234 100644 --- a/pkg/proxy/module.go +++ b/pkg/proxy/module.go @@ -15,7 +15,7 @@ import ( // EdgeProxy is used for traffic proxy type EdgeProxy struct { Config *v1alpha1.EdgeProxyConfig - ProxyServer *ProxyServer + ProxyServer *Server Socks5Proxy *Socks5Proxy } diff --git a/pkg/proxy/proxysocket.go b/pkg/proxy/proxysocket.go index 9d0bda17f..3477689f6 100644 --- a/pkg/proxy/proxysocket.go +++ b/pkg/proxy/proxysocket.go @@ -69,7 +69,7 @@ func (tcp *tcpProxySocket) ListenPort() int { return tcp.port } -func (tcp *tcpProxySocket) ProxyLoop(service proxy.ServicePortName, myInfo *userspace.ServiceInfo, loadBalancer userspace.LoadBalancer) { +func (tcp *tcpProxySocket) ProxyLoop(service proxy.ServicePortName, myInfo *userspace.ServiceInfo, _ userspace.LoadBalancer) { for { if !myInfo.IsAlive() { // The service port was closed or replaced. @@ -123,7 +123,7 @@ func (udp *udpProxySocket) Addr() net.Addr { return udp.LocalAddr() } -func (udp *udpProxySocket) ProxyLoop(service proxy.ServicePortName, myInfo *userspace.ServiceInfo, loadBalancer userspace.LoadBalancer) { +func (udp *udpProxySocket) ProxyLoop(service proxy.ServicePortName, myInfo *userspace.ServiceInfo, _ userspace.LoadBalancer) { var buffer [4096]byte // 4KiB should be enough for most whole-packets for { if !myInfo.IsAlive() { diff --git a/pkg/proxy/server.go b/pkg/proxy/server.go index 4fe17ed3b..0674385b8 100644 --- a/pkg/proxy/server.go +++ b/pkg/proxy/server.go @@ -31,8 +31,8 @@ import ( // Copy and update from https://github.com/kubernetes/kubernetes/blob/v1.23.0/cmd/kube-proxy/app/server.go and // https://github.com/kubernetes/kubernetes/blob/v1.23.0/cmd/kube-proxy/app/server_others.go. -// ProxyServer represents all the parameters required to start the Kubernetes proxy server. -type ProxyServer struct { +// Server represents all the parameters required to start the Kubernetes proxy server. +type Server struct { kubeClient clientset.Interface istioClient istioclientset.Interface IptInterface utiliptables.Interface @@ -64,7 +64,7 @@ func newProxyServer( lbConfig *v1alpha1.LoadBalancer, client clientset.Interface, istioClient istioclientset.Interface, - serviceFilterMode defaults.ServiceFilterMode) (*ProxyServer, error) { + serviceFilterMode defaults.ServiceFilterMode) (*Server, error) { klog.V(0).Info("Using userspace Proxier.") // Create a iptables utils. @@ -91,7 +91,7 @@ func newProxyServer( return nil, fmt.Errorf("unable to create proxier: %v", err) } - return &ProxyServer{ + return &Server{ kubeClient: client, istioClient: istioClient, IptInterface: iptInterface, @@ -103,7 +103,7 @@ func newProxyServer( }, nil } -func (s *ProxyServer) Run() error { +func (s *Server) Run() error { // Determine the service filter mode. // By default, we will proxy all services that are not labeled with the LabelEdgeMeshServiceProxyName label. operation := selection.DoesNotExist @@ -159,7 +159,7 @@ func (s *ProxyServer) Run() error { } // CleanupAndExit remove iptables rules -func (s *ProxyServer) CleanupAndExit() error { +func (s *Server) CleanupAndExit() error { ipts := []utiliptables.Interface{ utiliptables.New(s.execer, utiliptables.ProtocolIPv4), } diff --git a/pkg/proxy/socks5_proxy.go b/pkg/proxy/socks5_proxy.go index f9c9cfa51..a329eeb01 100644 --- a/pkg/proxy/socks5_proxy.go +++ b/pkg/proxy/socks5_proxy.go @@ -233,7 +233,7 @@ func (s *Socks5Proxy) HandleSocksProxy(conn net.Conn) { return } - targetIP, err := s.getTargetIpByNodeName(s.SocksHandle.Request.DstAddr) + targetIP, err := s.getTargetIPByNodeName(s.SocksHandle.Request.DstAddr) if err != nil { klog.Errorf("Unable to get destination IP, %v", err) return @@ -271,10 +271,10 @@ func proxyConnectToRemote(host string, targetIP string, port int32, conn net.Con klog.Infof("Success proxy to %v", host) } -// getTargetIpByNodeName Returns the real IP address of the node +// getTargetIPByNodeName Returns the real IP address of the node // We must obtain the real IP address of the node to communicate, so we need to query the IP address of the edgemesh-agent on the node // Because users may modify the IP addresses of edgemesh-0 and edgecore. If used directly, it may cause errors -func (s *Socks5Proxy) getTargetIpByNodeName(nodeName string) (targetIP string, err error) { +func (s *Socks5Proxy) getTargetIPByNodeName(nodeName string) (targetIP string, err error) { pods, err := s.kubeClient.CoreV1().Pods(s.Config.Namespace).List(context.Background(), metav1.ListOptions{FieldSelector: "spec.nodeName=" + nodeName, LabelSelector: LabelKubeedge}) if err != nil { return "", err diff --git a/pkg/tunnel/limit.go b/pkg/tunnel/limit.go index 4d23f6e7e..ef78e4fd8 100644 --- a/pkg/tunnel/limit.go +++ b/pkg/tunnel/limit.go @@ -51,11 +51,11 @@ func buildLimitOpt(scalingLimits *rcmgr.ScalingLimitConfig, opts ...rcmgr.Option // The resource manager expects a limiter, se we create one from our limits. limiter := rcmgr.NewFixedLimiter(limits) // Initialize the resource manager - if rm, err := rcmgr.NewResourceManager(limiter, opts...); err != nil { + rm, err := rcmgr.NewResourceManager(limiter, opts...) + if err != nil { return nil, err - } else { - return libp2p.ResourceManager(rm), nil } + return libp2p.ResourceManager(rm), nil } func CreateLimitOpt(config *v1alpha1.TunnelLimitConfig, opts ...rcmgr.Option) (libp2p.Option, error) { diff --git a/pkg/util/net/conn.go b/pkg/util/net/conn.go index 1e152cb18..e11714e9d 100644 --- a/pkg/util/net/conn.go +++ b/pkg/util/net/conn.go @@ -12,8 +12,8 @@ import ( "k8s.io/klog/v2" ) -// HttpRequestToBytes transforms http.Request to bytes -func HttpRequestToBytes(req *http.Request) ([]byte, error) { +// HTTPRequestToBytes transforms http.Request to bytes +func HTTPRequestToBytes(req *http.Request) ([]byte, error) { if req == nil { return nil, fmt.Errorf("http request nil") } diff --git a/pkg/util/tunutils/ipframe.go b/pkg/util/tunutils/ipframe.go index 6b06024eb..dd539468d 100644 --- a/pkg/util/tunutils/ipframe.go +++ b/pkg/util/tunutils/ipframe.go @@ -35,7 +35,7 @@ type IPFrame struct { Offset uint16 // 8 bits - Ttl byte + TTL byte // 8 bits Protocol byte @@ -151,7 +151,7 @@ func ParseIPFrame(buffer ByteBuffer) (*IPFrame, error) { // 5-headerLen: options(32...) if headerLen > minimumHeaderLen { options = make([]Option, headerLen-minimumHeaderLen) - for line := minimumHeaderLen; line < int(headerLen); line += 1 { + for line := minimumHeaderLen; line < int(headerLen); line++ { index := line * 4 options[line-minimumHeaderLen] = Option{ Key: BytesToUint16(bytes, index), @@ -171,7 +171,7 @@ func ParseIPFrame(buffer ByteBuffer) (*IPFrame, error) { Identification: identification, Flag: flag, Offset: offset, - Ttl: ttl, + TTL: ttl, Protocol: protocol, HeaderCheckSum: headerCheckSum, Source: source, @@ -204,7 +204,7 @@ func (frame *IPFrame) Strings() string { frame.Identification, frame.Flag, frame.Offset, - frame.Ttl, + frame.TTL, frame.Protocol, frame.HeaderCheckSum, frame.Source.String(), @@ -242,7 +242,7 @@ func (frame *IPFrame) ToBytes() []byte { bytes = append(bytes, byte(frame.Offset&0xff)) // 2: ttl(8) / protocol(8) / headerCheckSum(16) - bytes = append(bytes, frame.Ttl) + bytes = append(bytes, frame.TTL) bytes = append(bytes, frame.Protocol) bytes = append(bytes, 0x00, 0x00) @@ -274,7 +274,7 @@ func toBytes(options []Option) []byte { bytes := make([]byte, 0) - for i := 0; i < len(options); i += 1 { + for i := 0; i < len(options); i++ { bytes = append(bytes, options[i].toBytes()...) } @@ -291,11 +291,11 @@ func (option Option) toBytes() []byte { } func toCheckSum(bytes []byte) uint16 { - var checkSum uint32 = 0 + var checkSum uint32 num := len(bytes) >> 1 - for i := 0; i < num; i += 1 { + for i := 0; i < num; i++ { checkSum += uint32(BytesToUint16(bytes, i*2)) } diff --git a/pkg/util/tunutils/ipframe_test.go b/pkg/util/tunutils/ipframe_test.go index 7417c6e06..2a4cc26c6 100644 --- a/pkg/util/tunutils/ipframe_test.go +++ b/pkg/util/tunutils/ipframe_test.go @@ -50,8 +50,8 @@ func TestParseIPFrame(t *testing.T) { t.Errorf("Expected Offset to be 0, got %d", frame.Offset) } - if frame.Ttl != 64 { - t.Errorf("Expected Ttl to be 64, got %d", frame.Ttl) + if frame.TTL != 64 { + t.Errorf("Expected Ttl to be 64, got %d", frame.TTL) } if frame.Protocol != 6 { diff --git a/pkg/util/tunutils/tun.go b/pkg/util/tunutils/tun.go index 501a9817d..11257eeed 100644 --- a/pkg/util/tunutils/tun.go +++ b/pkg/util/tunutils/tun.go @@ -309,11 +309,11 @@ func (tun *TunConn) LocalAddr() net.Addr { return nil } func (tun *TunConn) RemoteAddr() net.Addr { return nil } -func (tun *TunConn) SetDeadline(t time.Time) error { return nil } +func (tun *TunConn) SetDeadline(_ time.Time) error { return nil } -func (tun *TunConn) SetReadDeadline(t time.Time) error { return nil } +func (tun *TunConn) SetReadDeadline(_ time.Time) error { return nil } -func (tun *TunConn) SetWriteDeadline(t time.Time) error { return nil } +func (tun *TunConn) SetWriteDeadline(_ time.Time) error { return nil } func Accept() (*TunConn, error) { return nil, nil }