fix: problem that disable l4proto+ipversion when single node is down

This commit is contained in:
mzz2017
2023-02-08 22:43:28 +08:00
committed by mzz
parent 00b8c6079e
commit f3e3ae2ae7
6 changed files with 40 additions and 20 deletions

View File

@ -58,12 +58,14 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) {
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)
}
dialer, err := outbound.Select(consts.L4ProtoStr_TCP, consts.IpVersionFromAddr(dst.Addr()))
l4proto := consts.L4ProtoStr_TCP
ipversion := consts.IpVersionFromAddr(dst.Addr())
dialer, err := outbound.Select(l4proto, ipversion)
if err != nil {
return fmt.Errorf("failed to select dialer from group %v: %w", outbound.Name, err)
}
c.log.WithFields(logrus.Fields{
"l4proto": "TCP",
"network": string(l4proto) + string(ipversion),
"outbound": outbound.Name,
"dialer": dialer.Name(),
}).Infof("%v <-> %v", RefineSourceToShow(src, dst.Addr()), RefineAddrPortToShow(dst))