parseLine returns an error if upstream configuration line is invalid.
(idx int, confLine string)
| 194 | |
| 195 | // parseLine returns an error if upstream configuration line is invalid. |
| 196 | func (p *configParser) parseLine(idx int, confLine string) (err error) { |
| 197 | if len(confLine) == 0 || confLine[0] == '#' { |
| 198 | return nil |
| 199 | } |
| 200 | |
| 201 | upstreams, domains, err := splitConfigLine(confLine) |
| 202 | if err != nil { |
| 203 | // Don't wrap the error since it's informative enough as is. |
| 204 | return err |
| 205 | } |
| 206 | |
| 207 | if upstreams[0] == "#" && len(domains) > 0 { |
| 208 | p.excludeFromReserved(domains) |
| 209 | |
| 210 | return nil |
| 211 | } |
| 212 | |
| 213 | for _, u := range upstreams { |
| 214 | err = p.specifyUpstream(domains, u, idx) |
| 215 | if err != nil { |
| 216 | // Don't wrap the error since it's informative enough as is. |
| 217 | return err |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | return nil |
| 222 | } |
| 223 | |
| 224 | // splitConfigLine parses upstream configuration line and returns list upstream |
| 225 | // addresses (one or many), list of domains for which this upstream is reserved |
no test coverage detected