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

Function patchServers

integrate/integrate.go:155–174  ·  view source on GitHub ↗

patchServers rewrites the first servers[].address/port for Trojan/SS style.

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

Source from the content-addressed store, hash-verified

153
154// patchServers rewrites the first servers[].address/port for Trojan/SS style.
155func patchServers(settings map[string]any, origHost string, origPort uint16) bool {
156 servers, ok := settings["servers"].([]any)
157 if !ok {
158 return false
159 }
160 for _, s := range servers {
161 sm, ok := s.(map[string]any)
162 if !ok {
163 continue
164 }
165 if _, has := sm["address"]; has {
166 sm["address"] = "127.0.0.1"
167 sm["port"] = 40443
168 _ = origHost
169 _ = origPort
170 return true
171 }
172 }
173 return false
174}
175
176// -- sing-box (JSON with typed outbounds) ---------------------------------
177

Callers 1

jsonProxyPatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected