MCPcopy
hub / github.com/cortesi/devd / formatURL

Function formatURL

server.go:101–117  ·  view source on GitHub ↗
(tls bool, httpIP string, port int)

Source from the content-addressed store, hash-verified

99}
100
101func formatURL(tls bool, httpIP string, port int) string {
102 proto := "http"
103 if tls {
104 proto = "https"
105 }
106 host := httpIP
107 if httpIP == "0.0.0.0" || httpIP == "127.0.0.1" {
108 host = "devd.io"
109 }
110 if port == 443 && tls {
111 return fmt.Sprintf("https://%s", host)
112 }
113 if port == 80 && !tls {
114 return fmt.Sprintf("http://%s", host)
115 }
116 return fmt.Sprintf("%s://%s:%d", proto, host, port)
117}
118
119// Credentials is a simple username/password pair
120type Credentials struct {

Callers 2

ServeMethod · 0.85
TestFormatURLFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatURLFunction · 0.68