MCPcopy
hub / github.com/cloudflare/cloudflared / ValidateUrl

Function ValidateUrl

config/configuration.go:165–175  ·  view source on GitHub ↗

ValidateUrl will validate url flag correctness. It can be either from --url or argument Notice ValidateUnixSocket, it will enforce --unix-socket is not used with --url or argument

(c *cli.Context, allowURLFromArgs bool)

Source from the content-addressed store, hash-verified

163// ValidateUrl will validate url flag correctness. It can be either from --url or argument
164// Notice ValidateUnixSocket, it will enforce --unix-socket is not used with --url or argument
165func ValidateUrl(c *cli.Context, allowURLFromArgs bool) (*url.URL, error) {
166 var url = c.String("url")
167 if allowURLFromArgs && c.NArg() > 0 {
168 if c.IsSet("url") {
169 return nil, errors.New("Specified origin urls using both --url and argument. Decide which one you want, I can only support one.")
170 }
171 url = c.Args().Get(0)
172 }
173 validUrl, err := validation.ValidateUrl(url)
174 return validUrl, err
175}
176
177type UnvalidatedIngressRule struct {
178 Hostname string `json:"hostname,omitempty"`

Callers 2

parseSingleOriginServiceFunction · 0.92
sshFunction · 0.92

Calls 3

ValidateUrlFunction · 0.92
GetMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected