MultiLineString is for outputting rules in a human-friendly way when Cloudflared is used as a CLI tool (not as a daemon).
()
| 35 | // MultiLineString is for outputting rules in a human-friendly way when Cloudflared |
| 36 | // is used as a CLI tool (not as a daemon). |
| 37 | func (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. |
| 55 | func (r *Rule) Matches(hostname, path string) bool { |
no test coverage detected