MCPcopy Create free account
hub / github.com/SamNet-dev/snix / patchVNext

Function patchVNext

integrate/integrate.go:132–152  ·  view source on GitHub ↗

patchVNext rewrites the first vnext[].address/port it finds. Returns true if changed.

(settings map[string]any, origHost string, origPort uint16)

Source from the content-addressed store, hash-verified

130
131// patchVNext rewrites the first vnext[].address/port it finds. Returns true if changed.
132func 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.
155func patchServers(settings map[string]any, origHost string, origPort uint16) bool {

Callers 1

jsonProxyPatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected