MCPcopy
hub / github.com/fabiolb/fabio / config

Method config

route/table.go:524–543  ·  view source on GitHub ↗
(addWeight bool)

Source from the content-addressed store, hash-verified

522}
523
524func (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.

Callers 2

TestTableParseFunction · 0.95
StringMethod · 0.95

Calls

no outgoing calls

Tested by 1

TestTableParseFunction · 0.76