MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / findLocalProxyPort

Function findLocalProxyPort

internal/nodeapi/check.go:92–114  ·  view source on GitHub ↗
(configJSON string)

Source from the content-addressed store, hash-verified

90}
91
92func findLocalProxyPort(configJSON string) string {
93if configJSON == "" {
94return ""
95}
96var cfg struct {
97Inbounds []struct {
98Protocol string `json:"protocol"`
99Port int `json:"port"`
100} `json:"inbounds"`
101}
102if err := json.Unmarshal([]byte(configJSON), &cfg); err != nil {
103return ""
104}
105for _, ib := range cfg.Inbounds {
106switch ib.Protocol {
107case "http":
108return fmt.Sprintf("http://127.0.0.1:%d", ib.Port)
109case "socks":
110return fmt.Sprintf("socks5://127.0.0.1:%d", ib.Port)
111}
112}
113return ""
114}
115
116type streamServiceDef struct {
117name string

Callers 1

DoCheckUnlockMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected