fix/optimize: reroute if necessary and add opendns as bootstrap dns

This commit is contained in:
mzz2017
2023-04-07 20:38:06 +08:00
parent efacd08910
commit 127a000058
5 changed files with 35 additions and 8 deletions

View File

@ -68,6 +68,11 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) {
outboundIndex = consts.OutboundControlPlaneRouting
}
dialTarget, shouldReroute := c.ChooseDialTarget(outboundIndex, dst, domain)
if shouldReroute {
outboundIndex = consts.OutboundControlPlaneRouting
}
switch outboundIndex {
case consts.OutboundDirect:
case consts.OutboundControlPlaneRouting:
@ -82,6 +87,8 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) {
outboundIndex.String(),
)
}
// Reset dialTarget.
dialTarget, _ = c.ChooseDialTarget(outboundIndex, dst, domain)
default:
}
// TODO: Set-up ip to domain mapping and show domain if possible.
@ -99,7 +106,6 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) {
return fmt.Errorf("failed to select dialer from group %v (%v): %w", outbound.Name, networkType.String(), err)
}
dialTarget, _ := c.ChooseDialTarget(outboundIndex, dst, domain)
if c.log.IsLevelEnabled(logrus.InfoLevel) {
c.log.WithFields(logrus.Fields{
"network": networkType.String(),