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

Function ServerPort

internal/serverapi/api.go:852–863  ·  view source on GitHub ↗

ServerPort 从 PULSE_SERVER_ADDR 解析监听端口,默认返回 8080。

()

Source from the content-addressed store, hash-verified

850
851// ServerPort 从 PULSE_SERVER_ADDR 解析监听端口,默认返回 8080。
852func ServerPort() int {
853 addr := config.Load().ServerAddr
854 _, portStr, err := net.SplitHostPort(addr)
855 if err != nil {
856 return 8080
857 }
858 port, err := strconv.Atoi(portStr)
859 if err != nil || port <= 0 {
860 return 8080
861 }
862 return port
863}
864
865func writeJSON(w http.ResponseWriter, status int, payload any) {
866 w.Header().Set("Content-Type", "application/json; charset=utf-8")

Callers 2

RunFunction · 0.92
doSyncNodeSNIProxyMethod · 0.85

Calls 1

LoadFunction · 0.92

Tested by

no test coverage detected