mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-27 20:53:01 +00:00
use no kernel tun for conflict errors
This commit is contained in:
parent
9f841662f1
commit
1a8b29aad3
1 changed files with 18 additions and 2 deletions
|
|
@ -238,8 +238,24 @@ func (s *OutboundService) createTestConfig(outboundTag string, allOutbounds []in
|
||||||
Settings: json_util.RawMessage(`{"auth":"noauth","udp":true}`),
|
Settings: json_util.RawMessage(`{"auth":"noauth","udp":true}`),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outbounds: copy all as-is, no tag or structure changes
|
// Outbounds: copy all, but set noKernelTun=true for WireGuard outbounds
|
||||||
outboundsJSON, _ := json.Marshal(allOutbounds)
|
processedOutbounds := make([]interface{}, len(allOutbounds))
|
||||||
|
for i, ob := range allOutbounds {
|
||||||
|
outbound := ob.(map[string]interface{})
|
||||||
|
if protocol, ok := outbound["protocol"].(string); ok && protocol == "wireguard" {
|
||||||
|
// Set noKernelTun to true for WireGuard outbounds
|
||||||
|
if settings, ok := outbound["settings"].(map[string]interface{}); ok {
|
||||||
|
settings["noKernelTun"] = true
|
||||||
|
} else {
|
||||||
|
// Create settings if it doesn't exist
|
||||||
|
outbound["settings"] = map[string]interface{}{
|
||||||
|
"noKernelTun": true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
processedOutbounds[i] = outbound
|
||||||
|
}
|
||||||
|
outboundsJSON, _ := json.Marshal(processedOutbounds)
|
||||||
|
|
||||||
// Create routing rule to route all traffic through test outbound
|
// Create routing rule to route all traffic through test outbound
|
||||||
routingRules := []map[string]interface{}{
|
routingRules := []map[string]interface{}{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue