(addWeight bool)
| 522 | } |
| 523 | |
| 524 | func (t Table) config(addWeight bool) []string { |
| 525 | var hosts []string |
| 526 | for host := range t { |
| 527 | if host != "" { |
| 528 | hosts = append(hosts, host) |
| 529 | } |
| 530 | } |
| 531 | sort.Sort(sort.Reverse(sort.StringSlice(hosts))) |
| 532 | |
| 533 | // entries without host come last |
| 534 | hosts = append(hosts, "") |
| 535 | |
| 536 | var cfg []string |
| 537 | for _, host := range hosts { |
| 538 | for _, routes := range t[host] { |
| 539 | cfg = append(cfg, routes.config(addWeight)...) |
| 540 | } |
| 541 | } |
| 542 | return cfg |
| 543 | } |
| 544 | |
| 545 | // String returns the routing table as config file which can |
| 546 | // be read by Parse() again. |
no outgoing calls