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

Method MultiLineString

ingress/rule.go:37–52  ·  view source on GitHub ↗

MultiLineString is for outputting rules in a human-friendly way when Cloudflared is used as a CLI tool (not as a daemon).

()

Source from the content-addressed store, hash-verified

35// MultiLineString is for outputting rules in a human-friendly way when Cloudflared
36// is used as a CLI tool (not as a daemon).
37func (r Rule) MultiLineString() string {
38 var out strings.Builder
39 if r.Hostname != "" {
40 out.WriteString("\thostname: ")
41 out.WriteString(r.Hostname)
42 out.WriteRune('\n')
43 }
44 if r.Path != nil && r.Path.Regexp != nil {
45 out.WriteString("\tpath: ")
46 out.WriteString(r.Path.Regexp.String())
47 out.WriteRune('\n')
48 }
49 out.WriteString("\tservice: ")
50 out.WriteString(r.Service.String())
51 return out.String()
52}
53
54// Matches checks if the rule matches a given hostname/path combination.
55func (r *Rule) Matches(hostname, path string) bool {

Callers 1

testURLCommandFunction · 0.80

Calls 2

WriteStringMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected