|
|
@@ -402,20 +402,17 @@ func (r *Router) Initialize(inbounds []adapter.Inbound, outbounds []adapter.Outb
|
|
|
defaultOutboundForPacketConnection = detour
|
|
|
}
|
|
|
}
|
|
|
- var index, packetIndex int
|
|
|
if defaultOutboundForConnection == nil {
|
|
|
- for i, detour := range outbounds {
|
|
|
+ for _, detour := range outbounds {
|
|
|
if common.Contains(detour.Network(), N.NetworkTCP) {
|
|
|
- index = i
|
|
|
defaultOutboundForConnection = detour
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if defaultOutboundForPacketConnection == nil {
|
|
|
- for i, detour := range outbounds {
|
|
|
+ for _, detour := range outbounds {
|
|
|
if common.Contains(detour.Network(), N.NetworkUDP) {
|
|
|
- packetIndex = i
|
|
|
defaultOutboundForPacketConnection = detour
|
|
|
break
|
|
|
}
|
|
|
@@ -432,22 +429,6 @@ func (r *Router) Initialize(inbounds []adapter.Inbound, outbounds []adapter.Outb
|
|
|
outbounds = append(outbounds, detour)
|
|
|
outboundByTag[detour.Tag()] = detour
|
|
|
}
|
|
|
- if defaultOutboundForConnection != defaultOutboundForPacketConnection {
|
|
|
- var description string
|
|
|
- if defaultOutboundForConnection.Tag() != "" {
|
|
|
- description = defaultOutboundForConnection.Tag()
|
|
|
- } else {
|
|
|
- description = F.ToString(index)
|
|
|
- }
|
|
|
- var packetDescription string
|
|
|
- if defaultOutboundForPacketConnection.Tag() != "" {
|
|
|
- packetDescription = defaultOutboundForPacketConnection.Tag()
|
|
|
- } else {
|
|
|
- packetDescription = F.ToString(packetIndex)
|
|
|
- }
|
|
|
- r.logger.Info("using ", defaultOutboundForConnection.Type(), "[", description, "] as default outbound for connection")
|
|
|
- r.logger.Info("using ", defaultOutboundForPacketConnection.Type(), "[", packetDescription, "] as default outbound for packet connection")
|
|
|
- }
|
|
|
r.inboundByTag = inboundByTag
|
|
|
r.outbounds = outbounds
|
|
|
r.defaultOutboundForConnection = defaultOutboundForConnection
|