new: add chain support & fix warp bug

This commit is contained in:
Hiddify
2024-01-30 19:13:14 +01:00
parent 571e910026
commit 8a56261e95
5 changed files with 42 additions and 11 deletions

View File

@@ -166,6 +166,15 @@ func patchOutbound(base option.Outbound, configOpt ConfigOptions) (*option.Outbo
}
func patchWarp(base *option.Outbound) error {
if base.Type == C.TypeWireGuard {
host := base.WireGuardOptions.Server
if host == "default" || host == "random" || host == "auto" {
base.WireGuardOptions.Server = getRandomIP()
}
if base.WireGuardOptions.ServerPort == 0 {
base.WireGuardOptions.ServerPort = generateRandomPort()
}
}
if base.Type == C.TypeCustom {
if warp, ok := base.CustomOptions["warp"].(map[string]interface{}); ok {
key, _ := warp["key"].(string)
@@ -186,6 +195,7 @@ func patchWarp(base *option.Outbound) error {
}
}
return nil
}