From 94f56fcccb40521469160652cc5c6705c3636050 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Thu, 16 Mar 2023 22:32:48 +0800 Subject: [PATCH] fix: should check index before finding outbound --- control/tcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/tcp.go b/control/tcp.go index 4ce2a4e..030416c 100644 --- a/control/tcp.go +++ b/control/tcp.go @@ -86,11 +86,11 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) { } default: } - outbound := c.outbounds[outboundIndex] // TODO: Set-up ip to domain mapping and show domain if possible. if outboundIndex < 0 || int(outboundIndex) >= len(c.outbounds) { return fmt.Errorf("outbound id from bpf is out of range: %v not in [0, %v]", outboundIndex, len(c.outbounds)-1) } + outbound := c.outbounds[outboundIndex] networkType := &dialer.NetworkType{ L4Proto: consts.L4ProtoStr_TCP, IpVersion: consts.IpVersionFromAddr(dst.Addr()),