patchVNext rewrites the first vnext[].address/port it finds. Returns true if changed.
(settings map[string]any, origHost string, origPort uint16)
| 130 | |
| 131 | // patchVNext rewrites the first vnext[].address/port it finds. Returns true if changed. |
| 132 | func patchVNext(settings map[string]any, origHost string, origPort uint16) bool { |
| 133 | vnext, ok := settings["vnext"].([]any) |
| 134 | if !ok { |
| 135 | return false |
| 136 | } |
| 137 | for _, v := range vnext { |
| 138 | vm, ok := v.(map[string]any) |
| 139 | if !ok { |
| 140 | continue |
| 141 | } |
| 142 | if _, has := vm["address"]; has { |
| 143 | vm["address"] = "127.0.0.1" |
| 144 | vm["port"] = 40443 |
| 145 | // Leave uuid, id, alterId, users, etc. untouched. |
| 146 | _ = origHost |
| 147 | _ = origPort |
| 148 | return true |
| 149 | } |
| 150 | } |
| 151 | return false |
| 152 | } |
| 153 | |
| 154 | // patchServers rewrites the first servers[].address/port for Trojan/SS style. |
| 155 | func patchServers(settings map[string]any, origHost string, origPort uint16) bool { |